Anya is a freshman at NTHU, she is trying to take the bus to Big City Mall.
”Anya coin ga suki, “ said Anya. It means Anya like coins, so she wants to use as least as possible coins to pay for the bus fare.
We all know that we can't make the change on the bus, so Anya wants to pay exactly the same price as the bus fare.
Given the bus fare, and the quantity of $1, $5, $10, and $50 coins that Anya has. How many coins that Anya needs to give at least?
A single line contains five integer numbers P, A, B, C, and D,
the Bus fare P that Anya needs to pay, and A to D is the quantity of $1, $5, $10, and $50 coins that she has respectively.
Print a single line containing one number:
If Anya can pay exactly the same price as the bus fare, print how many coins that Anya needs to give at least.
If she can't, print -1.
Please remember to print "\n" at the end.