Monopoly is a game in which players move over fields arranged in a circle, always in the clockwise direction. The fields are numbered to , both players start the game on field and never move backwards. If we know the total number of fields each player has traveled since the start of the game, we also know where each of them stands right now.
Your task is to compute how many steps forward the first player has to make to land on the field where the second player is standing.
Input
First line of input will be a single integer - the number of testcases.
Each of the next lines contains three integers , and - the number of fields on the board, the total number of fields the first player has traveled, and the total number of fields the second player has traveled since the start of the game.
Output
For every testcase print a single line with the number of steps forward the first player has to make to reach the field the second player is standing on.
Example
2 10 3 7 10 7 3
4 6
In the first testcase the players stand on fields and , so steps are enough. In the second the first player stands on field and the second on field - moving forward he passes fields and lands on , which is steps.
Constraints
This problem was adapted, with permission, from Monopol, authored by Društvo matematičara Srbije and Fondacija Petlja.