cho.sh
Notes
Loading...

Coins

Time limit

2s

Memory limit

128 MB

Problem

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.

Input

The first line contains five integers X, A, B, C, and D.

Output

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.

Constraints

  • 1 <= X <= 10,000
  • 0 <= A, B, C, D <= 10,000