410690: GYM104077 C Clone Ranran

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Clone Ranrantime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Ranran needs to prepare a contest! A contest is made of $$$c$$$ problems, and Ranran can do one of the following two things:

  • Clone himself in $$$a$$$ minutes. That is, after $$$a$$$ minutes, there will be one more Ranran.
  • Prepare a problem in $$$b$$$ minutes. That is, after $$$b$$$ minutes, there will be one more problem.

Note that a cloned Ranran can also do the two things above. A Ranran cannot do the two things at the same time.

Ranran wants to prepare the contest as fast as possible. But he is very lazy, so he asks you to find the minimum number of minutes to prepare the contest.

You need to answer $$$T$$$ queries independently.

Input

The first line contains an integer $$$T$$$ ($$$1\leq T\leq 10 ^ 5$$$).

Each of the next $$$T$$$ lines contains three integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1\leq a, b, c\leq 10 ^ 9)$$$, representing a query.

Output

For each test case, output a line with a single integer representing the answer.

ExampleInput
5
1 1 1
2 3 3
9 9 9
3 26 47
1064 822 1048576
Output
1
7
45
44
21860

加入题单

算法标签: