To encourage Kitorp’s promising coding career, his wife Asiar, offers him a prize if he wins (at least) two contest in a row in a three-set contest with his wife and Tourits alternatively: Asiar-Tourits-Asiar or Tourits-Asiar-Tourits, according to Kitorp’s choice.
Now, the probability of Kitorp defeating the opponents are given. Find out the probability of Kitorp winning the prize if he optimally chooses the series. Also, you need to find the expected number of wins for the chosen condition.
First line will contain the number of test cases T (0 < T ≤ 100000). The following T lines will have two double numbers t and a, the probability of defeating Tourits and Asiar.
Output the probability of Kitorp winning the prize and the expected number of wins. Error less than 10-6 will be ignored.
1 0.5 0.5