Problem: You went shopping to buy cakes and donuts with X yen (the currency of Japan).

First, you bought one cake for A yen at a cake shop. Then, you bought as many donuts as possible for B yen each, at a donut shop.

How much do you have left after shopping?

Constraints

* 1 \leq A, B \leq 1 000
* A + B \leq X \leq 10 000
* X, A and B are integers.

Input

Input is given from Standard Input in the following format:


X
A
B


Output

Print the amount you have left after shopping.

Examples

Input

1234
150
100


Output

84


Input

1000
108
108


Output

28


Input

579
123
456


Output

0


Input

7477
549
593


Output

405

Solution (in PYTHON):

Solution:
x=int(input())
a=int(input())
b=int(input())
v=x-a
i=0
while True:
    if v-(i*b)<0:
        break
    i+=1
b_i=b*(i-1)
print(v-b_i)