cho.sh
Notes
Loading...

Eggs

Time limit

1s

Memory limit

128 MB

Problem

Eggs are divided among four baskets. One unit operation works as follows.

  1. Choose two distinct baskets A and B that each contain at least one egg.
  2. Remove one egg from A and one egg from B.
  3. Choose one basket different from both A and B, and put both removed eggs into that basket.

Starting from the initial state, print the basket states in order until all eggs are gathered in one basket. The number of unit operations should be as small as possible, and the given value K is the benchmark operation count used for judging.

Input

The first line contains the benchmark number of unit operations K. The second line contains four integers separated by spaces: the numbers of eggs in the four baskets. The total number of eggs is between 4 and 3000, inclusive.

Output

On the first line, print the initial basket state in the same format as the input. On each following line, print the basket state after one unit operation. The last line must be a state where all eggs are gathered in one basket. The number of unit operations you print is the number of state lines after the first line.