P24226 [AtCoder] Last Card
入门
题目描述

Problem Statement

We will hand out a total of K cards to $N people numbered 1, 2, \ldots, N$.
Beginning with Person A, we will give the cards one by one to the people in this order: $A, A+1, A+2, \ldots, N, 1, 2, \ldots.$ Who will get the last card?
Formally, after Person $x(1 \leq x < N) gets a card, Person x+1$ will get a card. After Person N gets a card, Person 1 gets a card.

Input

Input is given from Standard Input in the following format:
N K A

Output

Print a number representing the person who will get the last card.

Constraints

  • $1 \leq N,K \leq 1000$
  • $1 \leq A \leq N$
  • All values in input are integers.

Sample Input 1

3 3 2

Sample Output 1

1

The cards are given to Person 2, 3, 1 in this order.

Sample Input 2

1 100 1

Sample Output 2

1

Sample Input 3

3 14 2

Sample Output 3

3

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 2
样例输出
1