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.

-----Sample Input-----
1234
150
100

-----Sample Output-----
84

You have 1234 - 150 = 1084 yen left after buying a cake.
With this amount, you can buy 10 donuts, after which you have 84 yen left.

Difficulty: introductory

Starter code:

Solutions:
print((int(input()) - int(input())) % int(input()))

X = int(input())
A = int(input())
B = int(input())

print(X - A - B * ((X - A) // B))

x=int(input())
a=int(input())
b=int(input())

print((x-a)%b)

x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

x = int(input())
a = int(input())
b = int(input())

print((x-a)%b)

# A - Buying Sweets

# X円で、A円のケーキ1個と、B円のドーナツを買えるだけ買った場合、残りは何円か


X = int(input())
A = int(input())
B = int(input())

print(((X - A) % B))


x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

X=int(input())
A=int(input())
B=int(input())
keki=X-A
donatu=keki%B
print(donatu)

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

x = int(input())
a = int(input())
b = int(input())
print((x - a) % b)

X = int(input())
A = int(input())
B = int(input())
print((X-A)%B)

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

X = int(input())
A = int(input())
B = int(input())

print((X - A) % B)

X = int(input())
A = int(input())
B = int(input())
print((X-A)%B)

X = int(input())
A = int(input())
B = int(input())
print((X-A)%B)

# あなたは、X 円を持ってケーキとドーナツを買いに出かけました。
# あなたはまずケーキ屋で 1個 A円のケーキを 1個買いました。
# 次に、ドーナツ屋で 1個 B 円のドーナツをできるだけたくさん買いました。
#
# これらの買い物のあと手元に残っている金額は何円ですか。

# 制約
# 1 ≦ A, B ≦ 1,000
# A + B ≦ X ≦ 10,000
# X, A, B は整数である

# 標準入力から、X, A, B の値を取得する
x = int(input())
a = int(input())
b = int(input())

# 残金を計算して出力する
result = 0

result = (x - a) % b
print(result)


x = int(input())
a = int(input())
b = int(input())
x -= a

while(1):
    x -= b
    if x - b < 0:
      print(x)
      break



x = int(input())
a = int(input())
b = int(input())

x -= a

while x >= b:
    x -= b

print(x)


x = int(input())
a = int(input())
b = int(input())

print((x - a) % b)

x=int(input())
a=int(input())
b=int(input())
print(((x-a)%b))


x = int(input())
a = int(input())
b = int(input())

n = x - a

print(n % ((n // b) * b))

x = int(input())
a = int(input())
b = int(input())

ans = x-a - (x-a)//b*b

print(ans)

x = int(input())
a = int(input())
b = int(input())

print((x-a-((x-a)//b)*b))


X, A, B = [int(input()) for _ in range(3)]
 
print((X-A) % B)

x=int(input())
print((x-int(input()))%int(input()))

with open(0) as f:
    x, a, b = map(int, f.read().split())
print(x - a - (x-a)//b*b)

a=[]
for i in range(3):
  a.append(int(input()))
  
print((a[0]-a[1])%a[2])

X = int(input())
A = int(input())
B = int(input())
print((X-A)%B)

# 087_a
X=int(input())
A=int(input())
B=int(input())

if (1<= (A+B) and X<= 10000) and (1<=A and A<= 1000) and (1<=B and B<= 1000):
    a=X-A
    b=int(a/B)
    print((a-(b*B)))


X=int(input())
A=int(input())
B=int(input())
print(((X-A)%B))


a = int(input())
b = int(input())
c = int(input())
print(((a - b) % c))


x, a, b = map(int, open(0).read().split())
print((x - a) % b)

x,a,b = [int(input()) for i in range(3)]
x -= a
print(x-b*(x // b))

X = int(input())
A = int(input())
B = int(input())

X = X - A
print(X - (X // B)*B)

a = [int(input()) for i in range(3)]
b = a[0]-a[1]
sub = b % a[2]

print(sub)

x = int(input())
a = int(input())
b = int(input())
x -= a
print(x%b)

X = int(input())
A = int(input())
B = int(input())

print((X - A) % B)

import sys

input = sys.stdin.readline
X = int(input())
A = int(input())
B = int(input())

X -= A
print(X - X // B * B)

x = int(input())
a = int(input())
b = int(input())

print((x-a) % b)

# A - Buying Sweets
# https://atcoder.jp/contests/abc087/tasks/abc087_a

X = int(input())
A = int(input())
B = int(input())

print(((X - A) % B))


x = int(input())
a = int(input())
b = int(input())
x -= a
x %= b
print(x)

x,a,b = [int(input()) for i in range(3)]
print((x-a)%b)

X = int(input())
A = int(input())
B = int(input())
print((X -A) % B)

X = int(input())
A = int(input())
B = int(input())

a = (X-A)%B

print(a)

#!/usr/bin/env python3

x = int(input())
a = int(input())
b = int(input())


print(((x-a) % b))


x = int(input())
a = int(input())
b = int(input())

answer = (x - a) % b
print(answer)

x,a,b = [int(input()) for i in range(3)]
print(x-a-(x-a)//b*b)

i = lambda: int(input())
print(((i() - i()) % i()))


X = int(input())
A = int(input())
B = int(input())
print(((X - A) % B))


#
# abc087 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1234
150
100"""
        output = """84"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1000
108
108"""
        output = """28"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """579
123
456"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """7477
549
593"""
        output = """405"""
        self.assertIO(input, output)


def resolve():
    X = int(input())
    A = int(input())
    B = int(input())

    print(((X-A) % B))


def __starting_point():
    # unittest.main()
    resolve()

__starting_point()

x = int(input())
A = int(input())
B = int(input())

ans = (x - A) % B
print(ans)

X = int(input())
A = int(input())
B = int(input())

print(X - A - B * ((X - A) // B))

x=int(input())
a=int(input())
b=int(input())

x-=a
num=x//b
x-=num*b
print(x)

a=int(input())
b=int(input())
c=int(input())
print((a-b)%c)

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

X = int(input())
A = int(input())
B = int(input())

# できるだけ買える個数
n = (X - A) // B

print((X - A - B * n))


x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

x=int(input())
a=int(input())
b=int(input())
x-=a
print(x%b)

x = int(input())
a = int(input())
b = int(input())

x -= a
while x >= b:
  x -= b
  
print(x)

x=int(input())
a=int(input())
b=int(input())
print(x-a-((x-a)//b)*b)


X=int(input())
A=int(input())
B=int(input())
X -= A
Y = X % B
print(Y)

X = int(input())
A = int(input())
B = int(input())
ans = X - A
ans %= B
print(ans)

x,a,b=[int(input()) for i in range(3)]
print(((x-a)%b))



x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

X=int(input())
A=int(input())
B=int(input())
keiki=X-A
donatu=keiki%B
print(donatu)

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

x=int(input())
a=int(input())
b=int(input())
x-=a
while x>=0:
  x-=b
print(x+b)

x = int(input())
a = int(input())
b = int(input())

ans = (x - a) % b

print(ans)

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

x = int(input())
a = int(input())
b = int(input())
print((x - a) % b)

X = int(input())
A = int(input())
B = int(input())

print((X - A) % B)

X = int(input())
A = int(input())
B = int(input())

# 答えは(X-A)をBで割った余り
X = X - A
print(X % B)

def main():
    x, a, b = (int(input()) for _ in range(3))
    t = x - a
    print(t - b * (t // b))


main()

x,a,b=int(input()),int(input()),int(input())
print(x-a-(x-a)//b*b)

X = int(input())
A = int(input())
B = int(input())

print((X - A) % B)

# 入力
X = int(input())
A = int(input())
B = int(input())

# A円のケーキを1個買う
balance = X - A

# 残金で買えるケーキBの数を求める
quantity = balance // B

# Bのケーキを変えるだけ買う
balance -= B * quantity

# 残金を出力する
print(balance)

X = int(input())
A = int(input())
B = int(input())
X -= A
n = int(X / B)
print(X - B * n)

x = int(input())
a = int(input())
b = int(input())

print((x - a) % b)

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x = int(input())
    a = int(input())
    b = int(input())

    x -= a
    res = x % b
    print(res)


def __starting_point():
    resolve()

__starting_point()

x = int(input())
a = int(input())
b = int(input())
print((x - a) % b)

possesion=int(input())
cake=int(input())
donut=int(input())

remain_1=possesion-cake
remain_2=remain_1-(remain_1//donut)*donut

print(remain_2)

x=int(input())
a=int(input())
b=int(input())
x-=a
x%=b
print(x)

x = int(input())
a = int(input())
b = int(input())
print(((x - a) % b))


x,a,b = [int(input()) for i in range(3)]
print(((x - a) % b))




x=int(input())
x-=int(input())
print(x%int(input()))

x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

X = int(input())
A = int(input())
B = int(input())

answer = ( X - A ) % B
print(answer)


x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)

#!/usr/bin/env python3

def main():
    x = int(input())
    a, b = (int(input()) for i in range(2))
    print(((x - a) % b))


def __starting_point():
    main()

__starting_point()

a = int(input())
b = int(input())
c = int(input())

print((a - b) % c)

x = int(input())
a = int(input())
b = int(input())
b = (x - a) // b * b
print(x - (a + b))


# あなたは、X円を持ってケーキとドーナツを買いに出かけました。
# あなたはまずケーキ屋で1個A円のケーキを1個買いました。 次に、ドーナツ屋で1個B円のドーナツをできるだけたくさん買いました。
# これらの買い物のあと手元に残っている金額は何円ですか。


X = int(input()) 
A = int(input())
B = int(input())

Y = X - A # Aを1個買って、残ったお金をY円とする。

print(Y % B)  

X,A,B=[int(input()) for i in range(3)]
print((X-A)%B)

X, A, B = int(input()), int(input()), int(input())
ans = (X-A)%B
print(ans)

x = int(input())
a = int(input())
b = int(input())
print(x - a - ((x-a)//b)*b)

x = int(input())
a = int(input())
b = int(input())

print((x-a)%b)

X = int(input())
A = int(input())
B = int(input())

print((X-A)%B)

X = int(input())
A = int(input())
B = int(input())
print(((X-A) % B))