Good Bye 2018
A
New Year and the Christmas Ornament
Codeforces
800
原题
←B →
翻译中…

Alice and Bob are decorating a Christmas Tree.

翻译中…

Alice wants only $3$ types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have $y$ yellow ornaments, $b$ blue ornaments and $r$ red ornaments.

翻译中…

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

翻译中…
  • the number of blue ornaments used is greater by exactly $1$ than the number of yellow ornaments, and
  • the number of red ornaments used is greater by exactly $1$ than the number of blue ornaments.
翻译中…

That is, if they have $8$ yellow ornaments, $13$ blue ornaments and $9$ red ornaments, we can choose $4$ yellow, $5$ blue and $6$ red ornaments ($5=4+1$ and $6=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 $7$ yellow, $8$ blue and $9$ red ornaments. If we do it, we will use $7+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 $6$ ($1+2+3=6$) ornaments.

翻译中…

Input

翻译中…

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

翻译中…

It is guaranteed that it is possible to choose at least $6$ ($1+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=24$.

翻译中…

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

翻译中…

样例

Input #1
8 13 9
Output #1
24
InputCopy OutputCopy
Input #2
13 3 6
Output #2
9
InputCopy OutputCopy
题目信息
题号
1091A
所属比赛
时间限制
1 s
内存限制
256 MB
标签
暴力
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。