Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Why the Long Face?

By ishtupeed · 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 T(1T100)T (1 \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,AD100)AD (0 < 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

    Discussion

    Statistics


    82% Solution Ratio

    BrehamPieEarliest, 1M ago

    NJRafiFastest, 0.0s

    BrehamPieLightest, 131 kB

    SyedshakilmahmShortest, 526B

    Submit

    Login to submit

    Toph uses cookies. By continuing you agree to our Cookie Policy.