#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d;
int degree;
while(cin>>a>>b>>c>>d)
{
if(a==0&&b==0&&c==0&&d==0) break;
//if(a<b) degree+=40;
//if(b>c) degree+=40;
//if(d>c) degree+=40;
cout<<((a-b)+(c-b)+(c-d)+(a<b)*40+(b>c)*40+(d>c)*40)*9+720+360<<endl;
}
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d;
int degree;
while(cin>>a>>b>>c>>d)
{
if(a==0&&b==0&&c==0&&d==0) break;
//if(a<b) degree+=40;
//if(b>c) degree+=40;
//if(d>c) degree+=40;
cout<<((a-b)+(c-b)+(c-d)+(a<b)*40+(b>c)*40+(d>c)*40)*9+720+360<<endl;
}
}
這樣:
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d;
while(cin>>a>>b>>c>>d&&(a+b+c+d))
cout<<((a-b)+(c-b)+(c-d)+(a<b)*40+(b>c)*40+(d>c)*40)*9+720+360<<endl;
}