402911: GYM100942 L Three machines

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Three machines time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Three machines read integers from the inserted cards and print new cards with pairs of positive integers. The first machine reads the card (a;b) and outputs a new card (a + 1;b + 1).The second machine reads the card (a;b), and if both numbers are even integers, outputs the card (a / 2;b / 2). When two cards (a;b) and (b;c) are inserted into the third machine, it outputs the card (a;c). All machines return the inserted cards.

There is a single card (a;b). It is necessary to obtain the card (c;d) or find it impossible.

Input

The first line contains integers a and b. The second line contains c and d (1 ≤ a, b, c, d ≤ 2000). The initial and the final cards are different.

Output

If it is not possible to obtain the required card, output 0. Otherwise print k in the first line — number of times the machines have been used. In the following k lines output usage description in the following format: « <number of the machine> <integers on the first card> [<integers on the second card>] ». If the third machine is used, the second integer on the first card must be equal to the first integer on the second card. k must not exceed 15000.

ExamplesInput
2 4
1 3
Output
3
2 2 4
1 1 2
3 1 2 2 3
Input
4 2
1 1
Output
0

加入题单

算法标签: