UVa 133 - The Dole Queue

Summary
A standard Simulation problem.

Explanation
A standard Simulation problem.

Input
10 4 3 0 0 0

Output
4 8,  9  5,  3  1,  2  6, 10,  7