Limits 1s, 512 MB

Consider the following figure:

Ciri and her horse Kelpie are standing at point AA. She needs to go to a coffee bar located at point BB. In front of them are the sand region (the shaded region) with width ADAD and the grass region with width CDCD. Assume that both the grass region and the sand region extend towards infinity with the same respective width in both directions. Kelpie can go twice as fast over the grass than the sand. Ciri wants to ride her horse to reach BB as fast as possible.

Given the length of BCBC, CDCD, and ADAD, find out the length of the path that Ciri and Kelpie will take.

Input

The first line of the input will contain an integer TT (1T1001 \leq T \leq 100), denoting the number of test cases.

For each test case, there will be three integers, BCBC, CDCD, and AD (0<BC,CD,AD1000 < BC, CD, AD \leq 100) - as described in the problem statement.

Output

For each test case, print a single value denoting the length of the path followed by a newline. Absolute errors less than 10410^{-4} will be ignored.

Sample

InputOutput
1
40 31 21
67.0000

Submit

Login to submit.

Statistics

83% Solution Ratio
BrehamPieEarliest, Aug '21
NJRafiFastest, 0.0s
BrehamPieLightest, 131 kB
SyedshakilmahmShortest, 526B
Toph uses cookies. By continuing you agree to our Cookie Policy.