Funny and Tricky are decorating their house. Funny wants three types of ornaments, yellow, blue and red. They have y yellow ornaments, b blue ornaments and r red ornaments. In Funny’s opinion, house 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).
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 Funny and Tricky are busy, they are asking you to find out the maximum number of ornaments. It is guaranteed that it is possible to choose at least 6 (1+2+3=6) ornaments.