Time limit
2s
Memory limit
128 MB
Charlie has A 1-cent coins, B 5-cent nickels, C 10-cent dimes, and D 25-cent quarters.
He wants to pay exactly X cents for coffee. Among all ways that do not use more coins than he has, he wants to use as many coins as possible in total.
Find how many 1-cent coins, nickels, dimes, and quarters he should use.
The first line contains five integers X, A, B, C, and D.
If it is possible to make exactly X cents, print the number of 1-cent coins, nickels, dimes, and quarters to use, in that order. The total number of used coins must be maximized.
If it is impossible, print 0 0 0 0.