BETA

Difficulty Level: Basic

Submissions: 483 Accuracy:

27.33%

Find the position of M-th item
     

M items are to be delivered in a circle of size N. Find the position where the M-th item will be delivered if we start from a given position K. Note that items are distributed at adjacent positions starting from K.

Input:
The first line consists of an integer T i.e number of test cases. The first and last line of each test case contains three integers N,M and K. 

Output:
Print the position where the Mth item will be delivered.

Constraints: 
1<=T<=100
1<=n,m,k<=1000

Example:
Input:

2
5 2 1
5 8 2

Output:
2
4

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.