There are three vases of sweets on the table. The left vase contains A candies, the middle vase contains B candies, and the right vase contains C candies. Lena eats one candy from the left vase,
then – one candy from the middle vase, then from the right, middle, left, middle, right, middle, etc. (left to right, then left, right again, etc.)
If Lena wants to take a candy from some vase, but there are no candies, she gets upset and goes to bed. Determine how many sweets Lena will eat.
The program receives as input three non-negative integers A, B, C – the number & nbsp; of sweets in the left, middle, right vase. The sum of these three numbers does not exceed 2×10
9.
Examples
# |
Input |
Output |
Explanation |
1 |
3
3
3 |
7 |
Lena will eat sweets from the left, middle, right, middle, left, middle, right vase. After that
she wants to eat the candy from the middle vase, but there are no candies left in it. |