Problem L. Mining in Starcraft

In Star Craft, there are two main resources: minerals and vespene gas ("gas" for short).

You can ask SCVs to mine minerals and collect gas.

You can only give a command to an SCV after its previous command is finished.

You can build new SCVs, each costing 50 units of mineral and takes t3 unit time. Those minerals are consumed at the beginning of the process, and you can build at most one SCV at a time (i.e. you cannot start building another SCV before the previous SCV is finished).

Initially, you have 50 units of minerals and 4 SCVs. Your task is to have at least p1 units of minerals and at least p2 units of gas, as soon as possible.

Input

Each test case contains 5 integers t1, t2, t3, p1, p2 (1<=t1,t2,t3<=10, 0<=p1,p2<=100). The last case is followed by t1=t2=t3=p1=p2=0, which should not be processed. There will be at most 1000 test cases, all are randomly generated.

Output

For each test case, print the shortest time T in the first line, followed by the plan (if multiple optimal plans exist, any will do). Each line in the plan has 3 kinds of format:

Print a blank line after each test case, including the last test case.

SCVs are numbered 1, 2, 3... Initial SCVs are numbered 1~4, newly built SCVs are numbered in the same order they're built.

Important: At time T, all the SCVs must be idle, and there should be no SCV being built.

Sample Input

10 9 8 0 10
4 10 9 32 72
0 0 0 0 0

Sample Output

Case 1: 9
0 1 2
0 2 2

Case 2: 24
0 0
0 1 1
0 2 1
0 3 1
0 4 1
4 1 2
4 2 2
4 3 2
4 4 2
14 1 2
14 2 2
14 3 2
14 4 2
14 5 2

Bonus

Be sure to test your program with the data provided in our gift package.


Rujia Liu's Present 7: Hello, Interactive Problems!
Original Problemsetter: Wenjie Qian
Original Problem Source: IOI China Team Selection Contest 2000
Adapted by Rujia Liu (to show his respect to Wenjie Qian)
Special thanks: Lijie Chen, Yubin Wang, Md. Mahbubul Hasan