#MTHA0000009. Ghế vòng tròn (Circular Seats)

Ghế vòng tròn (Circular Seats)

Circular Seats

Version: Phuoc Hung OJ Extended

Problem Statement

There are MM seats arranged in a circle and numbered from 11 to MM. Seat 11 follows seat MM. A student starts at seat SS and moves to the next seat clockwise at each step. Determine the seat after exactly TT steps.

Input

One line contains three integers MM, SS, and TT.

Output

Print the seat number after exactly TT steps.

Subtasks

  • Subtask 1 (30 points):
    • 1≤S≤M≤1061 \le S \le M \le 10^6.
    • 0≤T≤1060 \le T \le 10^6.
  • Subtask 2 (70 points):
    • 1≤S≤M≤10181 \le S \le M \le 10^{18}.
    • 0≤T≤10180 \le T \le 10^{18}.

Examples

Example 1

Input

8 3 0

Output

3

Explanation

No move is made, so the student remains at seat 33.

Example 2

Input

8 3 6

Output

1

Explanation

Starting from seat 33, six moves visit 4,5,6,7,8,14,5,6,7,8,1, so the final seat is 11.

Example 3

Input

100 100 1

Output

1

Explanation

Seat 11 follows seat 100100, so one step leads to seat 11.