Limits 1s, 512 MB

We all know, Argentina and Brazil supporters cannot stand each other. An organization decided to arrange a seminar about the importance of peace between football supporters. They invited MM Brazil supporters and NN Argentina supporters. They sat in a row. But if a Brazil and an Argentina supporter sat together, they fought. Even these supporters were so energetic that if one fought with his opponent on the left side and there was an opponent on the right side, he again fought. Each day the organization arranged sit differently from any previous arrangement hoping that there would be no fight. They stopped this seminar when they ran out of new permutations and realized there would never be peace between Argentina and Brazil supporters. Your task is to find out on average how many fights were there daily.

Consider all Brazil supporters are indistinguishable and the same for all Argentina supporters.

Input

First line of the input is an integer, t(1t10000)t (1\leq t\leq 10000) number of test cases.

Each test case contains two integers, MM and NN (1M,N105)(1\leq M,N\leq 10^{5}), number of Brazil and Argentina supporters.

Output

For each test case, print the average fights per day. Absolute or Relative error should be 106\leq10^{-6}.

Formally, let your answer be aa and the jury’s answer be bb. Your answer is accepted if and only if abmax(1,b)106\frac{\lvert a-b \lvert}{max(1,\lvert b \lvert)}\leq 10^{-6}.

Sample

InputOutput
1
2 2
2.00000000

Sample Explanation:

BBAA = 1

BABA = 3

BAAB = 2

ABAB = 3

AABB = 1

ABBA = 2

So average fight =1+3+2+3+1+26=2=\frac{1+3+2+3+1+2}{6}=2


Submit

Login to submit.

Statistics

86% Solution Ratio
adnan_tokyEarliest, Jul '21
hello.313Fastest, 0.0s
adnan_tokyLightest, 262 kB
mdalaminislamShortest, 102B
Toph uses cookies. By continuing you agree to our Cookie Policy.