#include<iostream>
#include<string>
using namespace std;
class student
{
double yuwen;//语文
double math;//数学
double english;//英语
double zong;//综合
public:
string name;
void set(string name1,double yuwen1,double math1,double english1,double zong1)
{
name=name1;
yuwen=yuwen1;
math=math1;
english=english1;
zong=zong1;
}
friend student top(const student *p,int count)
{
double sum=0,tp=0;
int q;
for(int i=0;i<count;i++)
{
tp=p[i].yuwen+p[i].math+p[i].english+p[i].zong;
if(sum<tp)
sum=tp;
}
cout<<sum;
return p[q];
}
};
int main()
{
string name;
double yuwen1;
double math1;
double english1;
double zong1;
double topp;
student a[100];
int i=0;
while(1)
{
cin>>name;
if(name!="0")
{
cin>>yuwen1>>math1>>english1>>zong1;
a[i++].set(name,yuwen1,math1,english1,zong1);
}
else
break;
}
top(a,i);
return 0;
}