First qualification round completed

Tasks

Show one task per page / all tasks on one page

"A" Martian Volleyball
Time limit 2 seconds
Memory limit 256 megabytes

Volleyball match at Mars is played by two teams until one of the teams gets k points, with score at least 2 points more than the score of the other team. For each ball played exactly one of the teams gets 1 point.

Now the score of the first team if x, the score of the second team is y. What is the minimal number of balls that must be played until one of the teams wins the match?

Input format

Input contains several test cases. The first line contains integer t — the number of cases (1 ≤ t ≤ 5000).

Each test case is described using one line that contains three integers separated by spaces: k, x and y (1 ≤ k ≤ 100; 0 ≤ x, y ≤ 100).

It is guaranteed that the score can be obtained in a correct unfinished game.

Output format

For each test case print one line — the minimal number of balls to be played, until the match is finished.

Examples
Input data
3
2 1 0
3 4 3
5 0 0
Output data
1
1
5
 

Send solution

Upload Maximal size is 256kb

Log in

VK Facebook

Forgot password?

Registration

The instruction for password recovery
has been sent to your email