
money=1000

price = int(input('물건 가격 : '))
price = money - price

five=(price)//500
hund=(price%500)//100
ften=(price%500%100)//50
ten=(price%500%100%50)//10

print(five+hund+ften+ten)




 
  

     





