Consider the following figure:
Ciri and her horse Kelpie are standing at point . She needs to go to a coffee bar located at point . In front of them are the sand region (the shaded region) with width and the grass region with width . 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 as fast as possible.
Given the length of , , and , find out the length of the path that Ciri and Kelpie will take.
The first line of the input will contain an integer , denoting the number of test cases.
For each test case, there will be three integers, , , and - as described in the problem statement.
For each test case, print a single value denoting the length of the path followed by a newline. Absolute errors less than will be ignored.
1 40 31 21
Login to submit