#MTHA0000010. Lịch trực luân phiên (Rotating Duty Schedule)

Lịch trực luân phiên (Rotating Duty Schedule)

Rotating Duty Schedule

Version: Phuoc Hung OJ Extended

Problem Statement

There are KK duty teams numbered from 11 to KK. Team SS is on duty on day 11. Each following day moves to the next team, wrapping from team KK to team 11. Determine the team on duty on day DD.

Input

One line contains three integers KK, SS, and DD.

Output

Print the team number on duty on day DD.

Subtasks

  • Subtask 1 (30 points):
    • 1≤S≤K≤1061 \le S \le K \le 10^6.
    • 1≤D≤1061 \le D \le 10^6.
  • Subtask 2 (70 points):
    • 1≤S≤K≤10181 \le S \le K \le 10^{18}.
    • 1≤D≤10181 \le D \le 10^{18}.

Examples

Example 1

Input

5 2 1

Output

2

Explanation

On day 11 no transition has happened, so team 22 is on duty.

Example 2

Input

5 2 5

Output

1

Explanation

The duty sequence from day 11 to day 55 is 2,3,4,5,12,3,4,5,1, so day 55 uses team 11.

Example 3

Input

7 7 100

Output

1

Explanation

There are 9999 transitions after day 11; 99 mod 7=199\bmod7=1, so one step from team 77 reaches team 11.