output_description: Print the amount of change as an integer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: N = int(input())
  N %= 1000
  if N != 1000:
      N = 1000 - N
  if N == 1000:
      N = 0
  count = 0
  if N >= 500:
      N -= 500
      count += 1
  while N >= 100:
      N -= 100
      count += 1
  while N >= 50:
      N -= 50
      count += 1
  while N >= 10:
      N -= 10
      count += 1
  while N >= 5:
      N -= 5
      count += 1
  while N >= 1:
      N -= 1
      count += 1
  print(count)
  
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."}]