zcmu-2195:Cableway

A group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway.

A cableway is represented by some cablecars, hanged onto some cable stations by a cable. A cable is scrolled cyclically between the first and the last cable stations (the first of them is located at the bottom of the mountain and the last one is located at the top). As the cable moves, the cablecar attached to it move as well.

The number of cablecars is divisible by three and they are painted three colors: red, green and blue, in such manner that after each red cablecar goes a green one, after each green cablecar goes a blue one and after each blue cablecar goes a red one. Each cablecar can transport no more than two people, the cablecars arrive with the periodicity of one minute (i. e. every minute) and it takes exactly 30 minutes for a cablecar to get to the top.

All students are divided into three groups: r of them like to ascend only in the red cablecars, g of them prefer only the green ones and b of them prefer only the blue ones. A student never gets on a cablecar painted a color that he doesn't like,

The first cablecar to arrive (at the moment of time 0) is painted red. Determine the least time it will take all students to ascend to the mountain top.

Input

The first line contains three integers rg and b (0≤r,g,b≤100). It is guaranteed that r+g+b>0, it means that the group consists of at least one student.

Output

Print a single number − the minimal time the students need for the whole group to ascend to the top of the mountain.

Examples

Input

1 3 2

Output

34

Input

3 2 1

Output

33

Note

Let's analyze the first sample.

At the moment of time 0 a red cablecar comes and one student from the r group get on it and ascends to the top at the moment of time 30.

At the moment of time 1 a green cablecar arrives and two students from the g group get on it; they get to the top at the moment of time 31.

At the moment of time 2 comes the blue cablecar and two students from the b group get on it. They ascend to the top at the moment of time 32.

At the moment of time 3 a red cablecar arrives but the only student who is left doesn't like red and the cablecar leaves empty.

At the moment of time 4 a green cablecar arrives and one student from the g group gets on it. He ascends to top at the moment of time 34.

Thus, all the students are on the top, overall the ascension took exactly 34 minutes.

 

#include<bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof a);
typedef long long ll;
const int maxn=1000+5;
int main()
{
    int a,b,c;
    int num[5];
    scanf("%d%d%d",&a,&b,&c);
     
    if(a>2) num[0]=(a/2+a%2-1)*3;
    else num[0]=0;
    if(b>2) num[1]=(b/2+b%2-1)*3+1;
    else
    {
        if(b==0) num[1]=0;
        else num[1]=1;
    }
    if(c>2) num[2]=(c/2+c%2-1)*3+2;
    else
    {
        if(c==0) num[2]=0;
        else num[2]=2;
    }
    sort(num,num+3);
    printf("%d\n",30+num[2]);
    return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章