favorite We need a little bit of your help to keep things running, click on this banner to learn more

Week 2: November 16 – 22. Conditional statement. Part 3

Bars of Gold

The highwaymen John and Bob robbed the caravan and got as a target three gold bars. They decided to divide the plunder like brothers. John and Bob weighed bars and found that they weigh x1, x2 and x3 pounds respectively.

Now John and Bob want to divide the bars so that each of them has got an equal amount of gold. They do not want to cut the bars, but nowhere to go. After discussing the situation, they decided that if they can, they will share the plunder as it is, and if not, they will saw only one bar into two parts. To saw two or all three bars of gold they can't.

Help John and Bob to choose the bar to saw into two parts, and the sizes of these parts, so that after cutting they can divide gold equally.


One line contains three integers: x1, x2 и x3 (1xi108, the sum of bar's weights is even).


If it is not possible to saw one bar so that to divide gold equally, print -1.

If John and Bob can divide the gold equally without sawing, print 0.

Otherwise print on the first line number 1, if they need to saw the first bar, 2 if they need to saw the second bar, 3 if they need to saw the third bar. On the second line print two positive integers: the weights of the parts into which the bar must be sawn. These parts in the sum must give the weight of original bar. The total weight of gold is even, so if the bar is cut, its parts have integers weight. If some solutions exist, print any.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3 3
Output example #1
2 1
Source 2016 XVII All Russia Team School Olympiad in Programming, December 11, Problem А