Banknotes in circulation come in denominations of , , , , , , , , and hryvnias. The Super-Duper-ATM has an ample supply of each denomination. Your task is to determine the minimum number of banknotes the ATM can dispense to total the amount .
A single integer , where 1 \leq S \leq 12345.
A single integer representing the minimum number of banknotes needed to dispense the specified amount.
Example 1
For example, the amount can be dispensed using 500+500+500+500+10+5+2+1, totaling eight banknotes. It is not possible to dispense the amount with fewer banknotes using the available denominations.