output_description: Print the amount you have left after shopping.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X
      A
      B
attempt: import sys
  
  sys.setrecursionlimit(1 << 25)
  read = sys.stdin.readline
  ra = range
  enu = enumerate
  
  
  def read_ints():
      return list(map(int, read().split()))
  
  
  def read_a_int():
      return int(read())
  
  
  def read_tuple(H):
      """
      H is number of rows
      """
      ret = []
      for _ in range(H):
          ret.append(tuple(map(int, read().split())))
      return ret
  
  
  def read_col(H):
      """
      H is number of rows
      A列、B列が与えられるようなとき
      ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
      """
      ret = []
      for _ in range(H):
          ret.append(list(map(int, read().split())))
      return tuple(map(list, zip(*ret)))
  
  
  def read_matrix(H):
      """
      H is number of rows
      """
      ret = []
      for _ in range(H):
          ret.append(list(map(int, read().split())))
      return ret
      # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため
  
  
  MOD = 10**9 + 7
  INF = 2**31  # 2147483648 > 10**9
  # default import
  from collections import defaultdict, Counter, deque
  from operator import itemgetter
  from itertools import product, permutations, combinations
  from bisect import bisect_left, bisect_right  # , insort_left, insort_right
  
  # https://atcoder.jp/contests/abc087/tasks/abc087_a
  X = read_a_int()
  A = read_a_int()
  B = read_a_int()
  print((X - A) % B)
  
problem_description: Statement
  
  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?
samples: [{"input": "1234\n    150\n    100", "output": "84\n    \n\nYou have 1234 - 150 = 1084 yen left after buying a cake. With this amount, you\ncan buy 10 donuts, after which you have 84 yen left.\n\n* * *"}, {"input": "1000\n    108\n    108", "output": "28\n    \n\n* * *"}, {"input": "579\n    123\n    456", "output": "0\n    \n\n* * *"}, {"input": "7477\n    549\n    593", "output": "405"}]