In the ATM, there are sufficient banknotes with denominations of 10,20,50,100,200, and 500 hryvnias. Find the minimum number of banknotes needed to dispense the amount of n hryvnias.
One integer n (1≤n≤106).
Print the minimum number of banknotes needed to dispense n hryvnias. Print −1 if the specified amount cannot be dispensed.
The sum of 770 hryvnia can be dispensed as follows: 500+200+50+20.