CF1091A.New Year and the Christmas Ornament

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

New Year and the Christmas Ornament

Alice and Bob are decorating a Christmas Tree.

Alice wants only 33 types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have yy yellow ornaments, bb blue ornaments and rr red ornaments.

In Bob's opinion, a Christmas Tree will be beautiful if:

  • the number of blue ornaments used is greater by exactly 11 than the number of yellow ornaments, and
  • the number of red ornaments used is greater by exactly 11 than the number of blue ornaments.

That is, if they have 88 yellow ornaments, 1313 blue ornaments and 99 red ornaments, we can choose 44 yellow, 55 blue and 66 red ornaments (5=4+15=4+1 and 6=5+16=5+1).

Alice wants to choose as many ornaments as possible, but she also wants the Christmas Tree to be beautiful according to Bob's opinion.

In the example two paragraphs above, we would choose 77 yellow, 88 blue and 99 red ornaments. If we do it, we will use 7+8+9=247+8+9=24 ornaments. That is the maximum number.

Since Alice and Bob are busy with preparing food to the New Year's Eve, they are asking you to find out the maximum number of ornaments that can be used in their beautiful Christmas Tree!

It is guaranteed that it is possible to choose at least 66 (1+2+3=61+2+3=6) ornaments.

Input

The only line contains three integers yy, bb, rr (1y1001 \leq y \leq 100, 2b1002 \leq b \leq 100, 3r1003 \leq r \leq 100) — the number of yellow, blue and red ornaments.

It is guaranteed that it is possible to choose at least 66 (1+2+3=61+2+3=6) ornaments.

Output

Print one number — the maximum number of ornaments that can be used.

Note

In the first example, the answer is 7+8+9=247+8+9=24.

In the second example, the answer is 2+3+4=92+3+4=9.

Samples

8 13 9
24
13 3 6
9

在线编程 IDE

建议全屏模式获得最佳体验