output_description: Print the amount of change as an integer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: def f(y):
  
      if 0 <= y <= 999:
          print(1000 - y)
      elif 1000 <= y <= 10000:
          b = int(y / 100)
          c = int(str(b)[1])
          g = 9 - c
          h = int(y / 10)
          i = int(str(h)[2])
  
          if y % 1000 == 0:
              print("0")
          elif y % 500 == 0 and x % 1000 != 0:
              print("500")
          elif y % 100 == 0 and x % 500 != 0:
              f = 10 - c
              print(f * 100)
          elif y % 10 == 0 and x % 100 != 0:
              j = 10 - i
              print(g * 100 + j * 10)
          elif y % 10 != 0:
              k = int(str(y)[3])
              l = 9 - i
              m = 10 - k
              print(g * 100 + l * 10 + m)
  
  
  y = input()
  x = f(int(y))
  
problem_description: Statement
  
  We will buy a product for N yen (the currency of Japan) at a shop.
  
  If we use only 1000-yen bills to pay the price, how much change will we
  receive?
  
  Assume we use the minimum number of bills required.
samples: [{"input": "1900", "output": "100\n    \n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\n* * *"}, {"input": "3000", "output": "0\n    \n\nWe can pay the exact price."}]