#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
struct x
{
char
name[30];
int
solve;
int
pe;
}team[200];
int cmp(const void*
a,const void* b)
{
x
*ta=(x*)a;
x
*tb=(x*)b;
if(ta->solve==tb->solve)
return tb->pe-ta->pe;
return
ta->solve-tb->solve;
}
int main()
{
int
n,i,j,temp[4][2],pene,sol;
scanf("%d",&n);
for(i=0;i<n;++i)
{
scanf("%s",team[i].name);
for(j=0;j<4;++j)
scanf("%d%d",&temp[j][0],&temp[j][1]);
sol=pene=0;
for(j=0;j<4;++j){
if(temp[j][1]!=0)
{
sol++;
pene+=temp[j][1]+20*(temp[j][0]-1);
}
}
team[i].solve=sol;
team[i].pe=pene;
}
qsort(team,n,sizeof(x),cmp);
printf("%s %d
%d\n",team[n-1].name,team[n-1].solve,team[n-1].pe);
return 0;
}