SP11604 REBOUND - The return of the Cake

Description

It is well known that, in byteland, when you throw a cake, the angle of reflexion is not the angle of incidence. Measured from the ground, the angle is the double, in byteland! ![rebound](../../content/francky:rebound-fig2 "rebound") You stand at point A(0, z), and you want to throw a cake in Leo's face. Leo stands at B(x, y) and is a very dangerous man, so you decide to use the ground in order to make your cake rebound. Your shot is precise only if you can use an integer value t in the intervall \[0, x\], in order to reflect on C(t, 0). Sometimes it's possible, sometimes not!

Input Format

The input begins with the number T of test cases in a single line. In each of the next T lines there are three integers x, y and z, explaining the locations : you A(0, z), Leo B(x, y).

Output Format

For each test case, find and print the only integer t such 0