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: # -*- coding:utf-8 -*-
  import sys
  
  sys.setrecursionlimit(10**5)
  input = sys.stdin.readline
  mod = 1000000007
  inf = float("INF")
  
  
  def I():
      return int(input().rstrip())
  
  
  def IR(n):
      return [I() for _ in range(n)]
  
  
  def LI():
      return list(map(int, input().rstrip().split()))
  
  
  def LIR(n):
      return [LI() for _ in range(n)]
  
  
  def LI_():
      return list(map(lambda x: int(x) - 1, input().rstrip().split()))
  
  
  def LIR_(n):
      return [LI_() for _ in range(n)]
  
  
  def F():
      return float(input().rstrip())
  
  
  def FR(n):
      return [F() for _ in range(n)]
  
  
  def LF():
      return list(map(float, input().rstrip().split()))
  
  
  def LFR(n):
      return [LI() for _ in range(n)]
  
  
  def S():
      return input().rstrip()
  
  
  def SR(n):
      return [S() for _ in range(n)]
  
  
  def LS():
      return list(sys.stdin.readline().rstrip().split())
  
  
  def LSR(n):
      return [LS() for _ in range(n)]
  
  
  x, a, b = IR(3)
  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"}]