Limits 1s, 512 MB

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.

Input

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

Output the probability of Kitorp winning the prize and the expected number of wins. Error less than 10-6 will be ignored.

Sample

InputOutput
1
0.5 0.5
0.375 1.5

Submit

Login to submit.

Statistics

45% Solution Ratio
curly_bracesEarliest, May '18
trqrizuFastest, 0.0s
LU_SchrodenBugLightest, 1.7 MB
LU_SchrodenBugShortest, 200B
Toph uses cookies. By continuing you agree to our Cookie Policy.