IITKWPCN - Playing With Balls

There are W white balls and B black balls in a bag. A magician is performing tricks by drawing balls from the bag.

In each step, the magician randomly removes any two balls from the bag. If the drawn balls are of the same color, he will put one white ball in the bag, otherwise he will put a black ball in it. The two drawn balls from the bag from the ball are discarded.

He keeps on doing the above tricks until there is only one ball remaining in the bag.

Given W and B, you have to determine the probability that the color of last ball remaining in the bag is black. You should print the answer with accuracy of up to 6 decimal digits.

Input

T : number of test cases (1 ≤ T ≤ 104)

For every test case W and B  are given (0 ≤ W ≤ 108 and 0 ≤ B ≤ 108 and W + B ≠ 0)

Output

For each test case, output the probability as stated in the problem statement.

Example

Input:
2
1 1
1 2

Output:
1.000000
0.000000

Added by:praveen123
Date:2013-08-06
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:IITK ACA CSE online judge

hide comments
2015-06-09 17:02:37 [Mayank Pratap]
Solve HC before this ... ..... I solved HC before but had to use arrays ....this time I had no choice.....
2015-03-27 06:40:05 ashish jaiswal
The two drawn balls from the bag from the ball are discarded..
plz explain me the meaning of ths line??
2015-02-08 07:16:08 jobanpreet singh
Easy by observation.
But is there any explanaiton which involves concepts of probability??Any link to such an explanation?
2014-09-29 23:53:42 Petar Bosnjak
so easy :D
2014-09-29 17:54:16 siddharth tiwari
eurekaaaaaa..!!!
2014-06-29 21:55:02 excursionist
Easy one :D
got ac
2014-06-29 19:17:55 Padam Preet
done...
2014-06-26 07:23:00 Diksha Jaiswal
12 line code...ac in 1 attempt :D
2014-02-24 03:42:32 odysseus
best (&& simple) question ever...
2014-02-22 20:53:15 ping_of_death
get hint Get ac...good logic..
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.