Little G is going to play games.
Little G is the king of gamers. If he wants to win, he will definitely win a game. But if he doesn't care about winning or losing, he will lose a game because of his bad luck. Little G has an expected winning rate of . When playing the
-th game, if his current winning rate is lower than or equal to
, he will be eager to win and win the game easily. Otherwise, he will enjoy the game and lose it.
The input consists of multiple test cases.
The first line consists of a single integer
(
) - the number of test cases.
In the following
lines, each line consists of three integers
(
), denoting a test case.
lines. Print one integer in each line, representing the answer of a test case.
In the first test case,:
When playing the first game, the winning rate =, so Little G will win the game;
When playing the second game, the winning rate =, so Little G will lose the game;
When playing the third game, the winning rate =, so Little G will win the game;
When playing the fourth game, the winning rate =, so Little G will lose the game.
In total, Little G will wingames, which is the answer of the first test case.