406339: GYM102367 A Cake Distribution

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

Description

A. Cake Distributiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are about to have a birthday and you would like to prepare a birthday cake that weighs anywhere between $$$1$$$ and $$$10^{18}$$$ grams inclusive. You know that there will be $$$A$$$, $$$B$$$ or $$$C$$$ guests at the party. You would like to cut this cake into pieces such that:

  • The weight of each piece is a positive integer number of grams.
  • No matter how many guests arrive, the pieces can be distributed between the guests in such a way that each guest gets the same amount of cake. Note that some guests might get more than one piece.

You don't want to spend too much time cutting the cake, so you would like to have at most 5,000 pieces. Let's do it!

Input

The only line of input contains the 3 numbers $$$A$$$, $$$B$$$, $$$C$$$, all positive integers not more than $$$1000$$$.

Output

On the first line, output one number $$$K$$$, the number of pieces. On each of the next $$$K$$$ lines, output a description of each piece, consisting of 4 numbers, $$$w_i$$$, $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, where $$$w_i$$$ is the weight of the piece in grams and $$$a_i$$$, $$$b_i$$$, $$$c_i$$$ are indices of the person who will get this piece if $$$A$$$, $$$B$$$, or $$$C$$$ guests arrive, respectively. The indices should satisfy $$$1 \leq a_i \leq A$$$, $$$1 \leq b_i \leq B$$$, $$$1 \leq c_i \leq C$$$. The sum of all $$$w_i$$$s must be less than or equal to $$$10^{18}$$$.

ExampleInput
1 2 3
Output
4
2 1 1 1
1 1 1 2
1 1 2 2
2 1 2 3

加入题单

算法标签: