Find the position of M-th item
Submissions: 583   Accuracy:

29.71%

  Difficulty: Basic   Marks: 1

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
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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


to report an issue on this page.