int main()
{
	int n,i,j,a1=8000,a2=4000,a3=2000,a4=1000,a5=850;
	int max=0,top=0,sum=0;
	int grade[100],assess[100],article[100],award[100];
	char west[100],official[100];
	char name[100][20];
	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		getchar();
		for (j=0;j<20;j++)
		{
			scanf("%c",&name[i][j]);
			if (name[i][j]==' ')
				break;
		}
		award[i]=0;
		scanf("%d %d %c %c %d",&grade[i],&assess[i],&official[i],&west[i],&article[i]);
		if (grade[i]>80 && article[i]>0)
			award[i]+=a1;
		if (grade[i]>85 && assess[i]>80)
			award[i]+=a2;
		if (grade[i]>90)
			award[i]+=a3;
		if (grade[i]>85 && west[i]=='Y')
			award[i]+=a4;
		if (assess[i]>80 && official[i]=='Y')
			award[i]+=a5;
		sum+=award[i];
		if (award[i]>max)
		{
			max=award[i];
			top=i;
		}
	}
	for(i=0;i<20;i++)
	{
		if(name[top][i]!=' ')
			printf("%c",name[top][i]);
		else
			break;
	}
	printf("\n%d\n%d\n",max,sum);
	return 0;
}


struct student
{
	char name[20];
	int s1,s2;
	char x,y;
	int l;
}stu[100];
int jiangjin(int i)
{
	int jiang=0;
	if(stu[i].s1>80&&stu[i].l>=1)
		jiang+=8000;
	if(stu[i].s1>85&&stu[i].s2>80)
		jiang+=4000;
	if(stu[i].s1>90)
		jiang+=2000;
	if(stu[i].s2>80&&stu[i].x=='Y')
		jiang+=850;
	if(stu[i].s1>85&&stu[i].y=='Y')
		jiang+=1000;
	return(jiang);
}

void main()
{
	int n,i,a[100],h,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].x,&stu[i].y,&stu[i].l);
	a[i]=jiangjin(i);
	}
	h=0;
	for(i=0;i<n;i++)
	{
		sum+=a[i];
		if(a[i]>a[h]){
			h=i;}
	}
	printf("%s\n%d\n%d",stu[h].name,a[h],sum);
}


void main()
{
	int i,n,max=0;
	unsigned long sum=0;
	struct student
	{
		char name[21];			//??
		int mark;				//??????
		int evaluation;			//??????
		char cadre;				//????
		char west;				//??????
		int thesis;				//???
		int scholarship;		//???
	};
	scanf("%d",&n);
	struct student *p = (struct student*)malloc(n * sizeof(struct student));
	for(i=0; i<n; i++)
	{
		struct student *q;
		q = p + i;
		q->scholarship = 0;
		scanf("%s %d %d %c %c %d",&(q->name),&(q->mark),&(q->evaluation),&(q->cadre),&(q->west),&(q->thesis));
		if(q->mark>80 && q->thesis>0)
			q->scholarship += 8000;			//?????
		if(q->mark>85 && q->evaluation>80)
			q->scholarship += 4000;			//?????
		if(q->mark>90)
			q->scholarship += 2000;			//?????
		if(q->mark>85 && q->west=='Y')
			q->scholarship += 1000;			//?????
		if(q->evaluation>80 && q->cadre=='Y')
			q->scholarship += 850;			//?????
		sum += q->scholarship;
	}
	for(i=1; i<n; i++)
	{
		if((p+i)->scholarship > (p+max)->scholarship)
			max = i;
	}
	printf("%s\n%d\n%d",(p+max)->name,(p+max)->scholarship,sum);
}


	struct student
	{
		char name [20];
		int score1;
		int score2;
		char moni;
		char west;
		int comp;
	}stu[100];
void main()
{
	struct student *p;
	int n,sum=0,t,s=0,d,i;
	char nam[20];
	scanf("%d",&n);
	for (  p=stu;p<stu+ n;p++)
		scanf("%s %d %d %c %c %d", &p->name,&p->score1,&p->score2,&p->moni,&p->west,&p->comp);
	p=stu;
	for (p=stu;p<stu+n;p++)
	{
		t=0;
       if (p->score1>80&&p->comp>=1)
		   t=t+8000;
	   if (p->score1>85&&p->score2>80)
		   t=t+4000;
	   if (p->score1>90)
		   t=t+2000;
	   if (p->score1>85&&p->west=='Y')
		   t=t+1000;
	   if (p->score2>80&&p->moni=='Y')
		   t=t+850;
	   if (t>s)
	   {
		   s=t;
		   d=strlen(p->name);
		   strcpy(nam,p->name);
		   for (i=d;i<20;i++)
			   nam[i]=0;
	   }
	   sum=sum+t;

	}
	puts(nam);

	printf("%d\n%d",s,sum);

}


struct student
{
	char name[20];
	int ave;
	int cla;
	char leader;
	char west;
	int paper;
};
void main()
{
	struct student stu[200];
	int n,i,count[200],count2[200],k,j,temp,l,all,max;
	all=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		count[i]=0;
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].ave,&stu[i].cla,&stu[i].leader,&stu[i].west,&stu[i].paper);
		if(stu[i].ave>80&&stu[i].paper>=1)
			count[i]=count[i]+8000;
		if(stu[i].ave>85&&stu[i].cla>80)
			count[i]=count[i]+4000;
		if(stu[i].ave>90)
			count[i]=count[i]+2000;
		if(stu[i].ave>85&&stu[i].west=='Y')
			count[i]=count[i]+1000;
		if(stu[i].cla>80&&stu[i].leader=='Y')
			count[i]=count[i]+850;
		all=all+count[i];

	}
	for(k=0;k<n;k++)
		count2[k]=count[k];
	max=count[0];
	for(j=0;j<n;j++)
		if(count[j]>max)
			max=count[j];
		for(l=0;l<n;l++)
			if(count2[l]==max)
				break;
		printf("%s\n%d\n%d\n",stu[l].name,max,all);
}


int main(int argc, char* argv[])
{
	int n,i,b=0,sum=0,max;
	struct student{
		char name[21];
		int mc;
		int bc;
		char bg;
		char xb;
		int lw;
		int sch;
	}stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		stu[i].sch=0;
		scanf("%s%d%d %c %c%d",&stu[i].name,&stu[i].mc,&stu[i].bc,&stu[i].bg,&stu[i].xb,&stu[i].lw);
		if(stu[i].mc>80&&stu[i].lw>0){
			stu[i].sch=8000;
			sum+=8000;
		}
		if(stu[i].mc>85&&stu[i].bc>80){
			stu[i].sch+=4000;
			sum+=4000;
		}
		if(stu[i].mc>90){
			stu[i].sch+=2000;
			sum+=2000;
		}
		if(stu[i].mc>85&&stu[i].xb=='Y'){
			stu[i].sch+=1000;
			sum+=1000;
		}
		if(stu[i].bc>80&&stu[i].bg=='Y'){
			stu[i].sch+=850;
			sum+=850;
		}
	}
	max=stu[0].sch;
	for(i=0;i<n;i++){
		if(max<stu[i].sch){
			max=stu[i].sch;
			b=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[b].name,stu[b].sch,sum);
	return 0;
}


struct student
{
	char name[20];
	int qm;
	int bj;
	char x;
	char xi;
	int lun;
	int award;
};
void main()
{
	struct student s[100];
	int i,N,k=0,p,q=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",s[i].name,&s[i].qm,&s[i].bj,&s[i].x,&s[i].xi,&s[i].lun);
		s[i].award=0;
	//	printf("%s %d %d %c %c %d\n",s[i].name,s[i].qm,s[i].bj,s[i].x,s[i].xi,s[i].lun);
	}
	for(i=0;i<N;i++)
	{
		if(s[i].qm>80&&s[i].lun>0)
			s[i].award=s[i].award+8000;
		if(s[i].qm>85&&s[i].bj>80)
			s[i].award=s[i].award+4000;
		if(s[i].qm>90)
			s[i].award=s[i].award+2000;
		if(s[i].qm>85&&s[i].xi=='Y')
			s[i].award=s[i].award+1000;
		if(s[i].bj>80&&s[i].x=='Y')
			s[i].award=s[i].award+850;
	}
	p=s[0].award;
	for(i=0;i<N;i++)
	{
		if(s[i].award>p)
			p=s[i].award;
	}
	q=0;
	for(i=0;i<N;i++)
	{
		if(s[i].award==p)
		{
			if(k==0)
			{
				k=k+1;
				printf("%s\n",s[i].name);
				printf("%d\n",p);
			}
		}
		q=q+s[i].award;
	}
	printf("%d",q);
}


void main()
{
	char name[100][100],student[100][5],west[100][5];
	int final[100], clas[100], essay[100],scholarship[100]={0};
	int n,total=0;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",&name[i],&final[i],&clas[i],&student[i],&west[i],&essay[i]);
	}
	for(i=0;i<n;i++)
	{
		if(final[i]>80&&essay[i]>=1)
			scholarship[i]=scholarship[i]+8000;
		if(final[i]>85&&clas[i]>80)
			scholarship[i]=scholarship[i]+4000;
		if(final[i]>90)
			scholarship[i]=scholarship[i]+2000;
		if(west[i][0]=='Y'&&final[i]>85)
			scholarship[i]=scholarship[i]+1000;
		if(student[i][0]=='Y'&&clas[i]>80)
			scholarship[i]=scholarship[i]+850;
		total=total+scholarship[i];
	}
	int max=0,k;
	for(i=0;i<n;i++)
	{
		if(scholarship[i]>max)
		{
			max=scholarship[i];
			k=i;
		}
	}
	printf("%s\n",name[k]);
	printf("%d\n%d\n",scholarship[k],total);
}


struct stu
{
	char name[21];
	int s1;
	int s2;
	char g;
	char x;
	int l;
	int m;
}stu[101];

int main(int argc, char* argv[])
{
	int n,i,j,sum=0,len,max=0,num;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].g,&stu[i].x,&stu[i].l);
		stu[i].m=0;
		if(stu[i].s1>80&&stu[i].l>=1){
			stu[i].m+=8000;
		}
		if(stu[i].s1>85&&stu[i].s2>80){
			stu[i].m+=4000;
		}
		if(stu[i].s1>90){
			stu[i].m+=2000;
		}
		if(stu[i].s1>85&&stu[i].x=='Y'){
			stu[i].m+=1000;
		}
		if(stu[i].s2>80&&stu[i].g=='Y'){
			stu[i].m+=850;
		}
		sum+=stu[i].m;
		if(stu[i].m>max){
			max=stu[i].m;
			num=i;
		}
	}
	printf("%s\n%d\n%d",stu[num].name,stu[num].m,sum);
	return 0;
}


void main()
{
	struct student
	{
		char name[20];
		int q;
		int b;
		char g;
		char x;
		int l;
	};
	struct student stu[100];
	int i,n;
    long sum[100]={0},sum2=0,sum1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf(P,stu[i].name,&stu[i].q,&stu[i].b,&stu[i].g,&stu[i].x,&stu[i].l);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].q>80&&stu[i].l>=1)
			sum[i]=sum[i]+8000;
		if(stu[i].q>85&&stu[i].b>80)
			sum[i]=sum[i]+4000;
		if(stu[i].q>90)
			sum[i]=sum[i]+2000;
		if(stu[i].q>85&&stu[i].x=='Y')
			sum[i]=sum[i]+1000;
		if(stu[i].b>80&&stu[i].g=='Y')
			sum[i]=sum[i]+850;
	}
	sum1=sum[0];
	sum2=sum[0];
	for(i=1;i<n;i++)
	{
		if(sum[i]>sum1)
			sum1=sum[i];
		sum2=sum2+sum[i];
	}
	for(i=0;i<n;i++)
	{
		if(sum1==sum[i])
		{
			printf("%s\n",stu[i].name);
			break;
		}
	}
	printf("%ld\n",sum1);
	printf("%ld\n",sum2);

}


int qm[102],bp[102],lw[102];
char bg[102]={'\0'},xb[102]={'\0'};
int yuanshi(int i)
{
	if(qm[i]>80&&lw[i]>0) return 8000;
		else return 0;
}
int wusi(int i)
{
	if(qm[i]>85&&bp[i]>80) return 4000;
		else return 0;
}
int youxiu(int i)
{
	if (qm[i]>90 ) return 2000;
		else return 0;
}
int xibu(int i)
{
	if(qm[i]>85&&xb[i]=='Y') return 1000;
		else return 0;
}
int banji(int i)
{
	if( bp[i]>80 && bg[i]=='Y') return 850;
		else return 0;
}

int main()
{
	int i,n,max,num,jxj[102]={0},sum=0;
	char name[102][21]={'\0'};
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>name[i]>>qm[i]>>bp[i]>>bg[i]>>xb[i]>>lw[i];
		jxj[i]=yuanshi(i)+wusi(i)+youxiu(i)+xibu(i)+banji(i);
	}
	max=jxj[1]; num=1,sum=jxj[1];
	for(i=2;i<=n;i++)
	{
		sum=sum+jxj[i];
		if (jxj[i]>max)
		{
			max=jxj[i];
			num=i;
		}
	}
	cout<<name[num]<<endl<<jxj[num]<<endl<<sum<<endl;
	return 0;
}


int main()
{
	int n,i,maxmoney,sum=0;
	char name[21];char maxname[21];
	int qimo[100]={0};int banji[100]={0};char ganbu[100];char xibu[100];int lunwen[100]={0};int money[100]={0};
	scanf("%d",&n);

	for(i=1;i<=n;i++)
	{
		scanf("%s",name);

		scanf(" %d %d",&qimo[i-1],&banji[i-1]);
		scanf(" %c %c",&ganbu[i-1],&xibu[i-1]);
		scanf(" %d",&lunwen[i-1]);
		if(qimo[i-1]>80&&lunwen[i-1]>=1) money[i-1]=money[i-1]+8000;
		if(qimo[i-1]>85&&banji[i-1]>80) money[i-1]=money[i-1]+4000;
		if(qimo[i-1]>90) money[i-1]=money[i-1]+2000;
		if(qimo[i-1]>85&&xibu[i-1]=='Y') money[i-1]=money[i-1]+1000;
		if(banji[i-1]>80&&ganbu[i-1]=='Y') money[i-1]=money[i-1]+850;
		if(i==1)
		{
			maxmoney=money[0];
		    strcpy(maxname,name);
		}
		sum=sum+money[i-1];
		if(i>=2)
		{

		if (money[i-1]>maxmoney)

		{
			maxmoney=money[i-1];
			strcpy(maxname,name);

		}

		}
	}

	printf("%s\n",maxname);
	printf("%d\n",maxmoney);
	printf("%d\n",sum);

	return 0;
}


int main()
{
	int N, i, final_g, class_g, nPapers;
	int scholarship, max_s, sum;
	char isCadre, isWest;
	char buffer[21];
	char name[21];

	scanf("%d", &N);
	sum = 0;
	max_s = 0;
	for (i=0; i<N; i++) {
		scanf("%s %d %d %c %c %d", buffer, &final_g, &class_g, &isCadre, &isWest, &nPapers);
		scholarship = 0;
				if (final_g>80 && nPapers>0)
			scholarship += 8000;
				if (final_g>85 && class_g>80)
			scholarship += 4000;
				if (final_g>90)
			scholarship += 2000;
				if (final_g>85 && isWest=='Y')
			scholarship += 1000;
				if (class_g>80 && isCadre=='Y')
			scholarship += 850;

		if (scholarship > max_s) {
			strcpy(name, buffer);
			max_s = scholarship;
		}
		sum += scholarship;
	}
	printf("%s\n%d\n%d\n", name, max_s, sum);

	return 0;
}


struct student
{
	char name[20];
	int score1;
	int score2;
	char mon;
	char west;
	int paper;
	int sum;
	struct student *next;
};

struct student *creat(int n)
{
	struct student *p1,*p2,*head;
	int many;
	int n1;
	n1=n;
	p1=p2=(struct student*)malloc(LEN);
	head=NULL;
	many=0;
	while(many<n1)
	{
		scanf("%s %d %d %c %c %d",&p1->name,&p1->score1,&p1->score2,&p1->mon,&p1->west,&p1->paper);
		many++;
		if(many==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
	}
	p2->next=NULL;
	return(head);
}

void print(struct student *head)
{
	struct student *p,*pmax;
	p=head;
	int total=0,max=0;
	if(head!=NULL)
		do
		{
			p->sum=0;
			if(p->score1>80&&p->paper>=1)p->sum=p->sum+8000;
			if(p->score1>85&&p->score2>80)p->sum=p->sum+4000;
			if(p->score1>90)p->sum=p->sum+2000;
			if(p->score1>85&&p->west=='Y')p->sum=p->sum+1000;
            if(p->score2>80&&p->mon=='Y')p->sum=p->sum+850;
			total=total+p->sum;
			p=p->next;
		}while(p!=NULL);
		p=head;
		do
		{
			if(p->sum>max){max=p->sum;pmax=p;}
			p=p->next;
		}while(p!=NULL);
		printf("%s\n%d\n%d\n",pmax->name,max,total);
}

void main()
{
	int n;
	struct student *head;
	scanf("%d",&n);
	head=creat(n);
	print(head);
}


void main()
{
	int n;
	scanf("%d",&n);
	struct student
	{
		char name[20];
		int score;
		int judge;
		char work;
		char west;
        int paper;
		int money;
	}stu[100];
	int i;
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].score,&stu[i].judge,&stu[i].work,&stu[i].west,&stu[i].paper);
		if(stu[i].score>80&&stu[i].paper>=1)
			stu[i].money=stu[i].money+8000;
		if(stu[i].score>85&&stu[i].judge>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].score>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].score>85&&stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].judge>80&&stu[i].work=='Y')
			stu[i].money=stu[i].money+850;
	}
	int max=0,sum=0;
	for(i=0;i<n;i++)
	{
		sum=sum+stu[i].money;
		if(stu[i].money>max)
			max=stu[i].money;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money==max)
		{
			printf("%s\n%d\n",stu[i].name,max);
		break;
		}
	}
	printf("%d\n",sum);
}


struct student
{
	char name[20];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int paper;
}stu[100];

int main()
{    int f(struct student s);
	int n,i,a[100],max,count=0,m=0,k=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].qimo ,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].paper);
	for(i=0;i<n;i++)
		a[i]=f(stu[i]);
	for(i=0;i<n;i++)
  sum=sum+a[i];
	max=a[0];
	for(i=0;i<n;i++)
      if(a[i]>max)
	  {max=a[i];
	  m=i;}
	  for(i=0;i<n;i++)
		  if(a[i]==max)
		  count++;
		  if(count==1)
			  printf("%s\n%d\n%d",stu[m].name,max,sum);
     else for(i=0;i<n;i++)
		 if(a[i]==max)
		 {printf("%s\n%d\n%d",stu[i].name,max,sum);
		 break;}
		 return 0;

}
    int f(struct student s)
	{int sum=0;
	if(s.qimo>80&&s.paper>=1)
		sum=sum+8000;
	if(s.qimo>85&&s.banji>80)
		sum=sum+4000;
	if(s.qimo>90)
		sum=sum+2000;
	if(s.qimo>85&&s.xibu=='Y')
		sum=sum+1000;
	if(s.banji>80&&s.ganbu=='Y')
		sum=sum+850;
	return sum;
	}


void main()
{
	struct student
	{
		char name[30],gb,west;
		int sco1,sco2,paper,money;
	} stu[100];
	int n,i;
	long sum=0,max=0;
	char maxs[30];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco1,&stu[i].sco2,&stu[i].gb,&stu[i].west,&stu[i].paper);
		stu[i].money=0;
		if (stu[i].sco1>80&&stu[i].paper>=1) stu[i].money+=8000;
		if (stu[i].sco1>85&&stu[i].sco2>80) stu[i].money+=4000;
		if (stu[i].sco1>90) stu[i].money+=2000;
		if (stu[i].sco1>85&&stu[i].west=='Y') stu[i].money+=1000;
		if (stu[i].sco2>80&&stu[i].gb=='Y') stu[i].money+=850;
	}
	for (i=0;i<n;i++)
	{
		sum+=stu[i].money;
		if (stu[i].money>max) {max=stu[i].money;strcpy(maxs,stu[i].name);}
	}
	printf("%s\n%ld\n%ld",maxs,max,sum);
}


int main()
{
    int N,i,price,total=0,max=0,t;
    scanf("%d",&N);
    struct student
    {
           char name[21];
           int ave;
           int comment;
           char officer;
           char province;
           int paper;
           }stu[100];
    for(i=0;i<N;i++){
                     scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].ave,&stu[i].comment,&stu[i].officer,&stu[i].province,&stu[i].paper);
                     }
    for(i=0;i<N;i++){
                     price=0;
                     if(stu[i].ave>80&&stu[i].paper>0){price=price+8000;}
                     if(stu[i].ave>85&&stu[i].comment>80){price=price+4000;}
                     if(stu[i].ave>90){price=price+2000;}
                     if(stu[i].ave>85&&stu[i].province=='Y'){price=price+1000;}
                     if(stu[i].comment>80&&stu[i].officer=='Y'){price=price+850;}
                     total=total+price;
                     if(price>max){
                                   max=price;
                                   t=i;
                                   }
                     }
    printf("%s\n%d\n%d\n",stu[t].name,max,total);

    return 0;
    }


struct data
{
	char name[200];
	int score;
	int classscore;
	char leader;
	char west;
	int paper;
	int scholarship;
	struct data *next;
};
int main()
{
	int N;
	scanf("%d",&N);

	int i,sum=0,max=0;
	struct data *head,*p1,*p2,*recorder;
	p1=(struct data *)malloc(Len);
	scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->classscore,&p1->leader,&p1->west,&p1->paper);
	p1->next=NULL;
	p1->scholarship=0;
	head=p1;
	p2=p1;

	for (i=1;i<N;i++)
	{
		p1=(struct data *)malloc(Len);
	    scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->classscore,&p1->leader,&p1->west,&p1->paper);
	    p1->next=NULL;
	    p1->scholarship=0;
	    p2->next=p1;
		p2=p1;
	}

	for (p1=head;p1!=NULL;p1=p1->next)
	{

		if (p1->paper>0&&p1->score>80) p1->scholarship+=8000;
		if (p1->score>85&&p1->classscore>80) p1->scholarship+=4000;
		if (p1->score>90) p1->scholarship+=2000;
		if (p1->score>85&& p1->west=='Y') p1->scholarship+=1000;
		if (p1->classscore>80 && p1->leader=='Y') p1->scholarship+=850;

		if (p1->scholarship>max)
		{
			max=p1->scholarship;
			recorder=p1;
		}
		sum=sum+p1->scholarship;
	}
	printf("%s\n%d\n%d\n",recorder->name,recorder->scholarship,sum);
	return 0;
}


struct Student
{
    char name[20];
    int a;
	int b;
    char g;
	char x;
    int l;
	int sum;
}stu[100];
int n;
int main()
{
   scanf("%d",&n);
   int i;
   int all=0;
   for(i=0;i<n;i++)
   {
	   scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].a,&stu[i].b,&stu[i].g,&stu[i].x,&stu[i].l);
       stu[i].sum=0;
	   if(stu[i].a>80&&stu[i].l>=1)
		   stu[i].sum+=8000;
	   if(stu[i].a>85&&stu[i].b>80)
		   stu[i].sum+=4000;
       if(stu[i].a>90)
		   stu[i].sum+=2000;
	   if(stu[i].a>85&&stu[i].x=='Y')
		   stu[i].sum+=1000;
	   if(stu[i].b>80&&stu[i].g=='Y')
		   stu[i].sum+=850;
	   all+=stu[i].sum;
   }
   int max=0;
   for(i=0;i<n;i++)
   {
	   if(max<stu[i].sum)
		   max=stu[i].sum;
   }
   for(i=0;i<n;i++)
   {
	   if(stu[i].sum==max)
	   {
		   printf("%s\n",stu[i].name);
		   printf("%d\n",stu[i].sum);
		   break;
	   }
   }
   printf("%d\n",all);
   return 0;
}


void main()
{
	struct student
	{
		char name[20];
		int score;
		int grade;
		char ganbu;
		char west;
		int paper;
		long money;
	};
	int a,i,j,n,sum;
	char c;
	struct student stu[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s%d%d%c%c%c%c%c%d",stu[i].name,&stu[i].score,&stu[i].grade,&c,&stu[i].ganbu,&c,&stu[i].west,&c,&stu[i].paper);
		stu[i].money=0;
	}
	for(i=0;i<=n-1;i++)
	{
		if (stu[i].score>80&&stu[i].paper>=1)
			stu[i].money=stu[i].money+8000;
		if (stu[i].score>85&&stu[i].grade>80)
			stu[i].money=stu[i].money+4000;
		if (stu[i].score>90)
			stu[i].money=stu[i].money+2000;
		if (stu[i].score>85&&stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if (stu[i].grade>80&&stu[i].ganbu=='Y')
			stu[i].money=stu[i].money+850;
	}
	j=0;
	a=stu[0].money;
	sum=stu[0].money;
	for(i=1;i<=n-1;i++)
	{
		if (stu[i].money>a)
		{
			j=i;
			a=stu[i].money;
		}
		sum=sum+stu[i].money;
	}
	printf("%s\n%d\n%d\n",stu[j].name,a,sum);
}


struct student{
	char mz[20];
	int cj;
	int py;
	char gb;
	char xb;
	int lw;
	int money;
};

int main(){
	int N,i,max,sum;
	scanf("%d",&N);
	struct student *stu=(struct student*)malloc(sizeof(struct student)*N);/*??????*/
	struct student *p;
	p=stu;
	for(i=0;i<N;i++,p++){
		scanf("%s %d %d %c %c %d",p->mz,&(p->cj),&(p->py),&(p->gb),&(p->xb),&(p->lw));/*????*/
	}
	p=stu;
	for(i=0;i<N;i++,p++){
		(p->money)=0;
		if (p->cj>80 && p->lw>0)
		{
			(p->money)+=8000;
		}
		if (p->cj>85 && p->py>80)
		{
			(p->money)+=4000;
		}
		if (p->cj>90)
		{
			(p->money)+=2000;
		}
		if (p->cj>85 && p->xb=='Y')
		{
			(p->money)+=1000;
		}
		if (p->py>80 && p->gb=='Y')
		{
			(p->money)+=850;
		}
	}/*?????*/
	sum=0;
	p=stu;
	for(i=0;i<N;i++,p++){
		sum+=(p->money);
	}/*?????*/
	max=0;
	for (i=0;i<N;i++)
	{
		if (stu[i].money>stu[max].money)
		{
			max=i;
		}
	}/*?????*/
	printf("%s\n%d\n%d\n",stu[max].mz,stu[max].money,sum);
	free(stu);
	return 0;
}


void main()
{
	struct std
	{
		char name[21];
		int cj;
		int py;
		char gb;
		char xb;
		int lw;
		int sum;
	}std[100];

	int n,i,max,sum=0;

	scanf("%d",&n);

	for(i=0;i<n;i=i+1)
	{
		scanf("%s %d %d %c %c %d",&std[i].name,&std[i].cj,&std[i].py,&std[i].gb,&std[i].xb,&std[i].lw);

		std[i].sum=0;

		if(std[i].cj>80&&std[i].lw>=1) std[i].sum=std[i].sum+8000;
		else;

		if(std[i].cj>85&&std[i].py>80) std[i].sum=std[i].sum+4000;
		else;

		if(std[i].cj>90) std[i].sum=std[i].sum+2000;
		else;

		if(std[i].xb=='Y'&&std[i].cj>85) std[i].sum=std[i].sum+1000;
		else;

		if(std[i].gb=='Y'&&std[i].py>80) std[i].sum=std[i].sum+850;
		else;

		sum=sum+std[i].sum;
	}

	for(i=1,max=std[0].sum;i<n;i=i+1)
	{
		if(max<std[i].sum) max=std[i].sum;
		else;
	}

	for(i=0;i<n;i=i+1)
	{
		if(std[i].sum==max)
		{
			printf("%s\n",std[i].name);
			printf("%d\n",std[i].sum);
			printf("%d\n",sum);
			break;
		}
	}
}


struct stus
{
    char name[25];
	int qimo;
	int banji;
	char ganbu;
    char xibu;
	int lunwen;
	int p;
};

void main()
{
	int m,n,i,j,k,s=0;
	char c[25]={0};
	struct stus stu[101]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
        if(stu[i].qimo>80&&stu[i].lunwen>=1)
			stu[i].p+=8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			stu[i].p+=4000;
		if(stu[i].qimo>90)
			stu[i].p+=2000;
		if(stu[i].xibu=='Y'&&stu[i].qimo>85)
			stu[i].p+=1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')
			stu[i].p+=850;
        s+=stu[i].p;
	}
	m=stu[0].p;
	strcpy(c,stu[0].name);
    for(i=1;i<n;i++)
		if(stu[i].p>m)
		{
            strcpy(c,stu[i].name);
            m=stu[i].p;
		}
	printf("%s\n",c);
	printf("%d\n%d",m,s);
}


int main()
{
    int n,i,sum=0,max=0;
    int stu[100],com[100],paper[100],money[100]={0};
    char name[100][20];
    char cadre[100],west[100];
    char best[20];
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        scanf("%s %d %d %c %c %d\n",name[i],&stu[i],&com[i],&cadre[i],&west[i],&paper[i]);
        if (stu[i]>80&&paper[i]>0)
            money[i]+=8000;
        if (stu[i]>85&&com[i]>80)
            money[i]+=4000;
        if (stu[i]>90)
            money[i]+=2000;
        if (stu[i]>85&&west[i]=='Y')
            money[i]+=1000;
        if (com[i]>80&&cadre[i]=='Y')
            money[i]+=850;
        if (money[i]>max)
        {
            max=money[i];
            strcpy(best,name[i]);
        }
        sum+=money[i];
    }
    printf("%s\n%d\n%d",best,max,sum);
}


struct student
{
	char name[20];
	int GPA;
	int val;
	char moni;
	char west;
	int paper;
	int scholar;

}stu[100];
void main()
{
	int n,i,max=0,sum,k;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].GPA,&stu[i].val,&stu[i].moni,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<=n-1;i++)
	{
		stu[i].scholar=0;
		if(stu[i].GPA>80&&stu[i].paper>=1)
			stu[i].scholar=stu[i].scholar+8000;
		if(stu[i].GPA>85&&stu[i].val>80)
			stu[i].scholar=stu[i].scholar+4000;
		if(stu[i].GPA>90)
			stu[i].scholar=stu[i].scholar+2000;
		if(stu[i].GPA>85&&stu[i].west=='Y')
			stu[i].scholar=stu[i].scholar+1000;
		if(stu[i].val>80&&stu[i].moni=='Y')
			stu[i].scholar=stu[i].scholar+850;

	}
	for(i=0,max=stu[0].scholar,sum=0;i<=n-1;i++)
	{
		if(stu[i].scholar>max)
		{
			k=i;
			max=stu[i].scholar;
		}
		sum=sum+stu[i].scholar;
	}

	printf("%s\n%d\n%d",stu[k].name,stu[k].scholar,sum);

}


struct scholarship
{
	char name[21];
	short mark;
	short judge;
	char cadre;
	char west;
	short paper;
	int ss;
}stu[100];
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].mark,&stu[i].judge,&stu[i].cadre,&stu[i].west,&stu[i].paper);
		stu[i].ss=0;
		if(stu[i].mark>80&&stu[i].paper>=1){
			stu[i].ss=stu[i].ss+8000;
		}
		if(stu[i].mark>85&&stu[i].judge>80){
			stu[i].ss=stu[i].ss+4000;
		}
		if(stu[i].mark>90){
			stu[i].ss=stu[i].ss+2000;
		}
		if(stu[i].mark>85&&stu[i].west=='Y'){
			stu[i].ss=stu[i].ss+1000;
		}
		if(stu[i].judge>80&&stu[i].cadre=='Y'){
			stu[i].ss=stu[i].ss+850;
		}
	}
	int max=stu[0].ss;
	int a=0;
	int total=0;
	for(i=0;i<n;i++){
		if(stu[i].ss>max){
			max=stu[i].ss;
			a=i;
		}
		total=total+stu[i].ss;
	}
	printf("%s\n%d\n%d\n",stu[a].name,stu[a].ss,total);
	return 0;
}


struct money
{
	char name[20];
	int qm;
	int bj;
	char gb;
	char xb;
	int lw;
}
main()
{
	struct money stu[100];
	int n,i,p;
	long a[100]={0},max=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qm,&stu[i].bj,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		if(stu[i].qm>80&&stu[i].lw>=1)
			a[i]=a[i]+8000;
		if(stu[i].qm>85&&stu[i].bj>80)
			a[i]=a[i]+4000;
		if(stu[i].qm>90)
			a[i]=a[i]+2000;
		if(stu[i].qm>85&&stu[i].xb=='Y')
			a[i]=a[i]+1000;
		if(stu[i].bj>80&&stu[i].gb=='Y')
			a[i]=a[i]+850;
	}
	for(i=0;i<n;i++)
	{
		sum=sum+a[i];
		if(max<a[i])
			max=a[i];
	}
	for(i=0;i<n;i++)
		if(max==a[i])
		{
			p=i;
			break;
		}
	printf("%s\n%ld\n%ld",stu[p].name,a[p],sum);
}


struct student
{
	char name[100];
	short int score1;
	short int score2;
	char x;
	char y;
	short int num;
	int sum;
	struct student *next;
};
void main()
{
	struct student *p1,*p2,*head;
	char name2[100];
	int max=0,s=0,i,n;
	p1=p2=head=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		p1=(struct student *)malloc(sizeof(struct student));
		scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->x,&p1->y,&p1->num);
		p1->sum=0;

		if(p1->score1>90)
		{
			p1->sum=2000;
			if(p1->score2>80)
			{
				p1->sum=p1->sum+4000;
				if(p1->x=='Y')p1->sum=p1->sum+850;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
			else
			{
				if(p1->num>=1)p1->sum=p1->sum+8000;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
			}
		}
		else if(p1->score1>85)
		{
			if(p1->score2>80)
			{
				p1->sum=p1->sum+4000;
				if(p1->x=='Y')p1->sum=p1->sum+850;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
			else
			{
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
		}
		else if(p1->score1>80)
		{
			if(p1->num>=1)p1->sum=p1->sum+8000;
			if(p1->score2>80&&p1->x=='Y')p1->sum=p1->sum+850;
		}
		else if(p1->score2>80&&p1->x=='Y')p1->sum=p1->sum+850;

		if(i==0)head=p1;
		else p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;

	max=head->sum;
	p1=head;
	while(p1!=NULL)
	{
		if(p1->sum>max){max=p1->sum;strcpy(name2,p1->name);}
		s=s+p1->sum;
		p1=p1->next;

	}
	printf("%s\n%d\n%d\n",name2,max,s);
}


struct studen{char name[100];int score1;int score2; char H;char W;int paper;int money;}stu[200];
int main()
{
	int n,i,j,money=0,student,scholar=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].score1,&stu[i].score2,&stu[i].H,&stu[i].W,&stu[i].paper);
		stu[i].money=0;
		if(stu[i].score1>80&&stu[i].paper>0)
			stu[i].money+=8000;
		if(stu[i].score1>85&&stu[i].score2>80)
			stu[i].money+=4000;
		if(stu[i].score1>90)
			stu[i].money+=2000;
		if(stu[i].score1>85&&stu[i].W=='Y')
			stu[i].money+=1000;
		if(stu[i].score2>80&&stu[i].H=='Y')
			stu[i].money+=850;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money>money)
		{
			student=i;
			money=stu[i].money;
		}
		scholar=scholar+stu[i].money;
	}
		printf("%s\n%d\n%d\n",stu[student].name,stu[student].money,scholar);
	return 0;
}


struct student
{
	char name[1000];
	int final;
	int aver;
	char xshe;
	char xb;
	int paper;
	int score;
	struct student *next;
};
int num;
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int i,n;
	n=0;
	p1=p2=(struct student*)malloc(LEN);

	scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->aver,&p1->xshe,&p1->xb,&p1->paper);
	p1->score=0;
	head=NULL;
	while(n<num-1)
	{
		n++;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->aver,&p1->xshe,&p1->xb,&p1->paper);
        p1->score=0;
	}
	p2->next=p1;
	p1->next=NULL;
	return (head);
}
void main()
{
		struct student *head,*p1,*p2,*p,*max;
		int sum=0;
		scanf("%d",&num);
		head=creat();
		p=p1=p2=head;
		for(;p!=NULL;p=p->next)
		{
			if((p->aver)>80&&p->xshe=='Y')
				p->score=p->score+850;
			if((p->final)>80&&(p->paper)>=1)
				p->score=p->score+8000;
			if((p->final)>85&&(p->aver)>80)
				p->score=p->score+4000;
			if((p->final)>90)
				p->score=p->score+2000;
			if((p->final)>85&&(p->xb)=='Y')
				p->score=p->score+1000;
		}
		max=p=head;
		for(;p!=NULL;p=p->next)
		{
			if((p->score)>max->score)
			max=p;
			sum=sum+p->score;
		}
		printf("%s\n%d\n%d\n",max->name,max->score,sum);
}


typedef struct
{
        char name[100];
        int qm,py;
        char gb,xb;
        int lw;
        int jxj;
} student;
student cl[200];
int sum,n;
void wsj(int k);
void yxj(int k);
void xbj(int k);
void gxj(int k);
void ysj(int k)
{
     if(cl[k].qm>80&&cl[k].lw>0)
     {
     cl[k].jxj+=8000;
     sum+=8000;
     }
     wsj(k);
}
void wsj(int k)
{
     if(cl[k].qm>85&&cl[k].py>80)
     {
     cl[k].jxj+=4000;
     sum+=4000;
     }
     yxj(k);
}
void yxj(int k)
{
     if(cl[k].qm>90)
     {
     cl[k].jxj+=2000;
     sum+=2000;
     }
     xbj(k);
}
void xbj(int k)
{
     if(cl[k].qm>85&&cl[k].xb=='Y')
     {
     cl[k].jxj+=1000;
     sum+=1000;
     }
     gxj(k);
}
void gxj(int k)
{
     if(cl[k].py>80&&cl[k].gb=='Y')
     {
     cl[k].jxj+=850;
     sum+=850;
     }
}
int main()
{
    int i,max=0,maxn;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
                     scanf("%s %d %d %c %c %d",cl[i].name,&cl[i].qm,&cl[i].py,&cl[i].gb,&cl[i].xb,&cl[i].lw);
        ysj(i);
        if(cl[i].jxj>max)
        {
                         max=cl[i].jxj;
                         maxn=i;
        }
    }
    printf("%s\n%d\n%d",cl[maxn].name,cl[maxn].jxj,sum);

    return 0;
}


int main() {
	struct stu1{
		char name[30];
		int scor;
		int grad;
		char as;
		char xi;
		int num;
		int reward;
	} stu[100], temp;
	int n, i, re=0;
		char hhh;
	scanf("%d" ,&n);
	for(i=0;i<n;i++) {
		scanf("%s%d%d%c%c%c%c%d", stu[i].name, &stu[i].scor, &stu[i].grad, &hhh,&stu[i].as,&stu[i].xi,&stu[i].xi, &stu[i].num);
		stu[i].reward=0;
		if(stu[i].scor>80&&stu[i].num>=1) {
			stu[i].reward+=8000;
		}
		if(stu[i].scor>85&&stu[i].grad>80) {
			stu[i].reward+=4000;
		}
		if(stu[i].scor>90) {
			stu[i].reward+=2000;
		}
		if(stu[i].scor>85&&stu[i].xi=='Y') {
			stu[i].reward+=1000;
		}
		if(stu[i].grad>80&&stu[i].as=='Y') {
			stu[i].reward+=850;
		}
	}
	temp=stu[0];
	for(i=0;i<n;i++) {
		if(stu[i].reward>temp.reward) {
			temp=stu[i];
		}
	}
	for(i=0;i<n;i++) {
			re+=stu[i].reward;
		}

	printf("%s\n%d\n%d", temp.name, temp.reward, re);
	return 0;
}


void main()
{
	struct student
	{
	char name[100];
	int marka;
	int markb;
	char ganbu;
	char xibu;
	int c;
	}stu[100];
	int n,i,j,max,sum=0;
	int money[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].marka,&stu[i].markb,&stu[i].ganbu,&stu[i].xibu,&stu[i].c);

	}
    for(i=0;i<n;i++)
	{
		if(stu[i].marka>80&&stu[i].c>0)
		{
			money[i]=money[i]+8000;
		}
		if(stu[i].marka>85&&stu[i].markb>80)
		{
			money[i]=money[i]+4000;
		}
		if(stu[i].marka>90)
		{
			money[i]=money[i]+2000;
		}
		if(stu[i].marka>85&&stu[i].xibu=='Y')
		{
			money[i]=money[i]+1000;
		}
		if(stu[i].markb>80&&stu[i].ganbu=='Y')
		{
			money[i]=money[i]+850;
		}
	}
	max=0;
	for(i=1;i<n;i++)
	{
		if(money[i]>money[max])
			max=i;
	}
	for(i=0;i<n;i++)
		sum=sum+money[i];
	printf("%s\n",stu[max].name);
	printf("%d\n",money[max]);
	printf("%d\n",sum);

}


struct student
{
	char name[20];
	int score1;
	int score2;
	char leader[2];
	char west[2];
	int paper;
	int money;
	struct student *next;
};
struct student *creat(int n)
{
	struct student *head;
	struct student *p1,*p2;
	int i;
	p1=p2=(struct student *)malloc(LEN);
	head=p1;
	for(i=0;i<n;i++)
	{
		p2=p1;
		scanf("%s%d%d%s%s%d",p1->name,&p1->score1,&p1->score2,&p1->leader,&p1->west,&p1->paper);
		{
			p1->money=0;
			if(p1->score1>80&&p1->paper!=0)
				p1->money=p1->money+8000;
			if(p1->score1>85&&p1->score2>80)
				p1->money=p1->money+4000;
			if(p1->score1>90)
				p1->money=p1->money+2000;
			if(p1->score1>85&&(strcmp(p1->west,"Y")==0))
				p1->money=p1->money+1000;
			if(p1->score2>80&&(strcmp(p1->leader,"Y")==0))
				p1->money=p1->money+850;
		}
		p1=(struct student *)malloc(LEN);
		p2->next=p1;
	}
	p2->next=NULL;
	return(head);
}
void print(struct student *head)
{
	struct student *p1;
	int max,all=0;
	p1=head;
	max=p1->money;
	do
	{
		if(p1->money>max)
			max=p1->money;
		all=all+p1->money;
		p1=p1->next;
	}
	while(p1->next!=NULL);
	if(p1->money>max)
		max=p1->money;
	all=all+p1->money;
	p1=head;
	for(;p1->next!=NULL;)
	{
		if(p1->money==max)
		{
			printf("%s\n%d\n",p1->name,p1->money);
			break;
		}
		p1=p1->next;
	}
	printf("%d",all);
}
void main()
{
	int n;
	struct student *head;
	scanf("%d",&n);
	head=creat(n);
	print(head);
}


struct student
{char name[20];
int test;
int judge;
char leader;
char west;
int paper;
};struct student stu[100];

void main()
{int m=0,n,i;
long sum,t=0,a[100]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].test,&stu[i].judge,&stu[i].leader,&stu[i].west,&stu[i].paper);
}
for(sum=0,i=0;i<n;i++)
 {if(stu[i].test>80&&stu[i].paper>0) {a[i]=a[i]+8000;}
  if(stu[i].test>85&&stu[i].judge>80) {a[i]=a[i]+4000;}
  if(stu[i].test>90) {a[i]=a[i]+2000;}
  if(stu[i].test>85&&(stu[i].west=='Y')) {a[i]=a[i]+1000;}
  if(stu[i].judge>80&&(stu[i].leader=='Y') ) {a[i]=a[i]+850;}
 sum=sum+a[i];
 if(a[i]>t) {t=a[i];m=i;}
 }
printf("%s\n",stu[m].name);
printf("%ld\n",t);
printf("%ld\n",sum);
}


int main()
{
	int N,i;
	int Endmark[100],Classmark[100],Essay[100],award[100]={0},sum=0,BP,X;
    char Name[100][21],Zone[100],Leader[100];
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%s %d %d %c %c %d",Name[i],&Endmark[i],&Classmark[i],&Leader[i],&Zone[i],&Essay[i]);
		if(Endmark[i]>80&&Essay[i]>0){
			award[i]+=8000;
		}
		if(Endmark[i]>85&&Classmark[i]>80){
			award[i]+=4000;
		}
		if(Endmark[i]>90){
			award[i]+=2000;
		}
		if(Endmark[i]>85&&Zone[i]=='Y'){
			award[i]+=1000;
		}
		if(Classmark[i]>80&&Leader[i]=='Y'){
			award[i]+=850;
		}
		sum+=award[i];
	}
	BP=award[0];
	X=0;
	for(i=0;i<N;i++){
		if(award[i]>BP){
            BP=award[i];
			X=i;
		}
	}
	printf("%s\n",Name[X]);
	printf("%d\n",award[X]);
	printf("%d\n",sum);

return 0;
}


int main()
{
    int n,i,max=0,sum=0,t;
    scanf("%d",&n);
    struct student
    {
       char name[20];
       int ascore;
       int bscore;
       char good;
       char west;
       int work;
       int money;
     }stu[100];
	 for(i=0;i<n;i++)
		 stu[i].money=0;
     for(i=0;i<n;i++)
     {
         scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].ascore,&stu[i].bscore,&stu[i].good,&stu[i].west,&stu[i].work);
      }
      i=0;
      for(i=0;i<n;i++)
      {
          if(stu[i].ascore>80&&stu[i].work>=1)
          stu[i].money=stu[i].money+8000;
          if(stu[i].ascore>85&&stu[i].bscore>80)
          stu[i].money=stu[i].money+4000;
          if(stu[i].ascore>90)
          stu[i].money=stu[i].money+2000;
          if(stu[i].ascore>85&&stu[i].west=='Y')
          stu[i].money=stu[i].money+1000;
          if(stu[i].bscore>80&&stu[i].good=='Y')
          stu[i].money=stu[i].money+850;
      }
      for(i=0;i<n;i++)
      sum=sum+stu[i].money;
      i=0;
      for(i=0;i<n-1;i++)
      {
         if(stu[i].money>max)
          {
              max=stu[i].money;
              t=i;
           }
       }
       printf("%s\n%d\n%d\n",stu[t].name,stu[t].money,sum);
}


struct student
{
  char name[20];
  int qimo;
  int banji;
  char ganbu;
  char xibu;
  int paper;
}stu[100];
void main()
{
	int n,i,s[100]={0},sum=0,k,max;
	struct student *p;
	scanf("%d",&n);
    for(p=stu,i=0;p<stu+n;p++,i++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->qimo,&p->banji,&p->ganbu,&p->xibu,&p->paper);
        if(p->qimo>80&&p->paper>=1)
			s[i]+=8000;
		if(p->qimo>85&&p->banji>80)
			s[i]+=4000;
		if(p->qimo>90)
			s[i]+=2000;
		if(p->qimo>85&&p->xibu=='Y')
			s[i]+=1000;
		if(p->banji>80&&p->ganbu=='Y')
			s[i]+=850;
	}
	max=s[0];
	for(i=0;i<n;i++)
	{
		sum+=s[i];
		if(s[i]>max)
		{
			max=s[i];
			k=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[k].name,s[k],sum);
}


struct asd
{
	char str[21];
	int a;
	int b;
	int c;
	int sum;
	char x;
	char y;
}stu[100];

void main()
{
	int i,n,max,m,t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d", stu[i].str, &stu[i].a, &stu[i].b, &stu[i].x, &stu[i].y, &stu[i].c);
		stu[i].sum=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].a>80 && stu[i].c>0)
			stu[i].sum+=8000;
		if(stu[i].a>85 && stu[i].b>80)
			stu[i].sum+=4000;
		if(stu[i].a>90)
			stu[i].sum+=2000;
		if(stu[i].a>85 && stu[i].y=='Y')
			stu[i].sum+=1000;
		if(stu[i].b>80 && stu[i].x=='Y')
			stu[i].sum+=850;
	}

	m=0;
	for(i=0;i<n;i++)
	{
		m+=stu[i].sum;
	}

	max=0;t=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].sum>max)
		{max=stu[i].sum;t=i;}
	}

	printf("%s\n%d\n%d\n", stu[t].str, max, m);
}


int main()
{
	struct student
	{
		char name[20];
		int mark1;
		int mark2;
		int number;
		char a[2];
                  char b[2];
	};
	int i,m,n[100],p=0,q=0,w=0;
	scanf("%d",&m);
	struct student stu[100];
	for(i=0;i<m;i++)
	{
		scanf("%s ",stu[i].name);
		scanf("%d ",&stu[i].mark1);
		scanf("%d ",&stu[i].mark2);
		scanf("%s ",&stu[i].a);
		scanf("%s ",&stu[i].b);
		scanf("%d",&stu[i].number);
	}
	for(i=0;i<m;i++)
	{	n[i]=0;
		if(stu[i].mark1>80&&stu[i].number>=1)
			n[i]+=8000;
		if(stu[i].mark1>85&&stu[i].mark2>80)
			n[i]+=4000;
		if(stu[i].mark1>90)
			n[i]+=2000;
		if(stu[i].mark1>85&&stu[i].b[0]=='Y')
			n[i]+=1000;
		if(stu[i].mark2>80&&stu[i].a[0]=='Y')
			n[i]+=850;
	}
	for(i=0;i<m;i++)
	{
		if(n[i]>p)
		{
			p=n[i];
			w=i;
		}
		q=q+n[i];
	}
	printf("%s\n",stu[w].name);
	printf("%d\n",n[w]);
         printf("%d\n",q);
	return 0;
}


struct stu{
	char name[20];
	int final;
	int cla;
	char ban[2];
	char xi[2];
	int pap;
	int sum;
}a[100];

int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a[i].name);
		scanf("%d%d",&a[i].final,&a[i].cla);
		scanf("%s",a[i].ban);
		scanf("%s",a[i].xi);
		scanf("%d",&a[i].pap);
	}
    for(i=0;i<n;i++){
		a[i].sum=0;
		if(a[i].final>80&&a[i].pap>=1)
			a[i].sum=a[i].sum+8000;
		if(a[i].final>85&&a[i].cla>80)
			a[i].sum=a[i].sum+4000;
		if(a[i].final>90)
			a[i].sum=a[i].sum+2000;
		if(a[i].final>85&&a[i].xi[0]=='Y')
			a[i].sum=a[i].sum+1000;
		if(a[i].cla>80&&a[i].ban[0]=='Y')
			a[i].sum=a[i].sum+850;
	}
	int max=a[0].sum;
	int t=0,zong=0;
	for(i=0;i<n;i++){
		if(max<a[i].sum){
			max=a[i].sum;
			t=i;
		}
        zong=zong+a[i].sum;
	}
	printf("%s\n%d\n%d\n",a[t].name,a[t].sum,zong);
	return 0;
}


struct student
{
	char name[30];
	int qimocj;
	int banjicj;
	char ganbu;
	char xibu;
	int lunwen;
	int jiangjin;
};
int main()
{
	int n,i,sum=0;
	struct student ren[102]={0},max={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",ren[i].name,&ren[i].qimocj,&ren[i].banjicj,&ren[i].ganbu,&ren[i].xibu,&ren[i].lunwen);
	}
	for(i=0;i<n;i++)
	{
		if(ren[i].qimocj>80 && ren[i].lunwen>=1)
		{
			ren[i].jiangjin+=8000;
		}
		if(ren[i].qimocj>85 && ren[i].banjicj>80)
		{
			ren[i].jiangjin+=4000;
		}
		if(ren[i].qimocj>90)
		{
			ren[i].jiangjin+=2000;
		}
		if(ren[i].qimocj>85 && ren[i].xibu=='Y')
		{
			ren[i].jiangjin+=1000;
		}
		if(ren[i].banjicj>80 && ren[i].ganbu=='Y')
		{
			ren[i].jiangjin+=850;
		}
	}
	max.jiangjin=0;
	for(i=0;i<n;i++)
	{
		sum+=ren[i].jiangjin;
		if(ren[i].jiangjin>max.jiangjin)
		{
			max=ren[i];
		}
	}
	printf("%s\n%d\n%d\n",max.name,max.jiangjin,sum);
	return 0;
}


int main()
{
	int n,i,sum=0,k=0,t;
	struct point{char name[21],ganbu,xibu;int x,y,z,money;}stu[100];

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].x,&stu[i].y,&stu[i].ganbu,&stu[i].xibu,&stu[i].z);
		stu[i].money=0;
		if(stu[i].x>80&&stu[i].z>0)
		{
            stu[i].money+=8000;
			sum+=8000;
		}
		if(stu[i].x>85&&stu[i].y>80)
		{
            stu[i].money+=4000;
			sum+=4000;
		}
		if(stu[i].x>90)
		{
            stu[i].money+=2000;
			sum+=2000;
		}
		if(stu[i].x>85&&stu[i].xibu=='Y')
		{
            stu[i].money+=1000;
			sum+=1000;
		}
		if(stu[i].y>80&&stu[i].ganbu=='Y')
		{
            stu[i].money+=850;
			sum+=850;
		}
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money>k)
		{
			k=stu[i].money;
			t=i;
		}
	}
	printf("%s\n",stu[t].name);
	printf("%d\n",stu[t].money);
	printf("%d",sum);
	return 0;
}


struct student
{
	char name[20];
	int qimo;
	int banpin;
	char ganbu;
	char xibu;
	int lunwen;
	double sum;
}stu[100];
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].qimo,&stu[i].banpin,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
		stu[i].sum=0;
        if(stu[i].qimo>80&&stu[i].lunwen>0)stu[i].sum=stu[i].sum+8000;
		if(stu[i].qimo>85&&stu[i].banpin>80)stu[i].sum=stu[i].sum+4000;
		if(stu[i].qimo>90)stu[i].sum=stu[i].sum+2000;
		if(stu[i].xibu=='Y'&&stu[i].qimo>85)stu[i].sum=stu[i].sum+1000;
        if(stu[i].ganbu=='Y'&&stu[i].banpin>80)stu[i].sum=stu[i].sum+850;
	}
	int max=0,totalsum=0;
	for(i=0;i<n;i++)
	{if(stu[i].sum>max)max=stu[i].sum;}
	for(i=0;i<n;i++)
	{if(stu[i].sum==max){printf("%s\n",stu[i].name);break;}}
	for(i=0;i<n;i++)
	{
	totalsum=totalsum+stu[i].sum;
	}
	printf("%d\n%d",max,totalsum);
}


int main()
{
	int i,n,sum=0;
	scanf("%d",&n);
	typedef struct{
		char name[20];
		char ganbu;
		char xibu;
		int qimo;
		int qizhong;
		int lunwen;
		int money;
	}jiangxuejin;
	jiangxuejin a[100];
	jiangxuejin *p,*max;
	max=a;
	for(p=a;p<a+n;p++)
	{
		p->money=0;
		scanf("%s %d %d %c %c %d",&p->name,&p->qimo,&p->qizhong,&p->ganbu,&p->xibu,&p->lunwen);
		if((p->qimo>80)&&(p->lunwen>=1))
		(p->money)+=8000;
		if((p->qimo>85)&&(p->qizhong>80))
		(p->money)+=4000;
		if(p->qimo>90)
		(p->money)+=2000;
		if((p->qimo>85)&&(p->xibu=='Y'))
		(p->money)+=1000;
		if((p->qizhong>80)&&(p->ganbu=='Y'))
		(p->money)+=850;
		if(p->money>max->money)
		max=p;
		sum+=p->money;
	}
	printf("%s\n%d\n%d",max->name,max->money,sum);
}


struct stu
{
	char name[20];
	int mark1;
	int mark2;
	char position;
	char hometown;
	int paper;
	int fund;
	struct stu *next;
};

struct stu *creat(int n)
{
	int i=1;
	struct stu *head;
	struct stu *p1,*p2;
	p1=(struct stu *)malloc(sizeof(struct stu));
	scanf(A,p1->name,&p1->mark1,&p1->mark2,&p1->position,&p1->hometown,&p1->paper);
	p1->fund=0;
	if(n==1)
	{
		head=p1;
		p1->next=NULL;
		free(p1);
		return head;
	}
	else
	{
		head=p1;
		p2=p1;
		do
		{
			p1=(struct stu *)malloc(sizeof(struct stu));
			scanf(A,p1->name,&p1->mark1,&p1->mark2,&p1->position,&p1->hometown,&p1->paper);
			p1->fund=0;
			i++;
			if(i==n)
			{
				p1->next=NULL;
				p2->next=p1;
				break;
			}
			else
			{
				p2->next=p1;
				p2=p1;
			}
		}while(1);
		return head;
	}
}

int main(void)
{
	int n,i,j=0,max=0;
	struct stu *head;
	struct stu *p;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	while(p)
	{
		if(p->mark1>80&&p->paper>0)
			p->fund+=8000;
		if(p->mark1>85&&p->mark2>80)
			p->fund+=4000;
		if(p->mark1>90)
			p->fund+=2000;
		if(p->mark1>85&&p->hometown=='Y')
			p->fund+=1000;
		if(p->mark2>80&&p->position=='Y')
			p->fund+=850;
		p=p->next;
	}
	p=head;
	while(p)
	{
		/*printf("%d %d\n",p->fund,i);*/
		j+=p->fund;
		if(p->fund>max)
			max=p->fund;
		p=p->next;
	}
	p=head;
	while(p)
		if(max==p->fund)
		{
			printf("%s\n%d\n%d\n",p->name,p->fund,j);
			break;
		}
		else p=p->next;
}


int main()
{
	struct data
	{
		char name[22];
		int score1;
		int score2;
		char mas;
		char dis;
		int paper;
		int sum;
	}p[100];
	int n;
	scanf("%d",&n);
	int i = 0 ;
	for ( i = 0 ; i < n ; i++ )
	{
		scanf("%s",p[i].name);
		scanf("%d",&(p[i].score1));
		scanf("%d",&(p[i].score2));
		getchar();
		scanf("%c",&(p[i].mas));
		getchar();
		scanf("%c",&(p[i].dis));
		scanf("%d",&(p[i].paper));
	}
	for ( i = 0 ; i < n ; i++ )
	{
		p[i].sum = 0;
	}
	int k = 0;
	int max = 0;
	int total = 0;
	for ( i = 0 ; i < n ; i++ )
	{
		if ( p[i].score1 > 80 && p[i].paper >= 1 )
		{
			p[i].sum += 8000;
		}
		if ( p[i].score1 > 85 && p[i].score2 > 80)
		{
			p[i].sum += 4000;
		}
		if ( p[i].score1 > 90 )
		{
			p[i].sum += 2000;
		}
		if ( p[i].score1 > 85 && p[i].dis == 'Y' )
		{
			p[i].sum += 1000;
		}
		if ( p[i].score2 > 80 && p[i].mas == 'Y' )
		{
			p[i].sum += 850;
		}
		total += p[i].sum;
		if ( p[i].sum > max )
		{
			max = p[i].sum;
			k = i;
		}
	}
	printf("%s\n",p[k].name);
	printf("%d\n",max);
	printf("%d\n",total);
	return 0;
}


int main()
{
	int i,n,j,r,t,m,q=0;
	int a[101];
	struct student {
		char name[20];
		int zong;
		int ban;
		char gan;
		char xi;
		int lun;
		int z;
	}stu[101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		{
		    scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].zong,&stu[i].ban,&stu[i].gan,&stu[i].xi,&stu[i].lun);
		}
	for(i=1;i<=n;i++)
		{   stu[i].z=0;
			if(stu[i].zong>80&&stu[i].lun>0)
				stu[i].z=stu[i].z+8000;
			if(stu[i].zong>85&&stu[i].ban>80)
				stu[i].z=stu[i].z+4000;
			if(stu[i].zong>90)
				stu[i].z=stu[i].z+2000;
			if(stu[i].zong>85&&stu[i].xi=='Y')
				stu[i].z=stu[i].z+1000;
			if(stu[i].ban>80&&stu[i].gan=='Y')
				stu[i].z=stu[i].z+850;
			a[i]=stu[i].z;
			q=q+stu[i].z;
		}
	for(j=n;j>0;j--)
	{	for(r=0;r<j;r++)
			if(stu[r].z>stu[r+1].z)
			{t=stu[r+1].z;
			stu[r+1].z=stu[r].z;
			stu[r].z=t;
			}
	}
	for(i=1;i<=n;i++)
		if(a[i]==stu[n].z)
		{	m=i;
			break;
		}

printf("%s\n%d\n%d\n",stu[m].name,stu[n].z,q);
return 0;
}


struct student
{
	char name[20];
	int test;
	int term;
	char key;
	char west;
	int art;
	int money;
}person[100];
int main()
{
	int n,i,j,q=0,k;
	struct student temp;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %d %d %c %c %d",person[i].name,&person[i].test,&person[i].term,&person[i].key,&person[i].west,&person[i].art);
	    person[i].money=0;
		if(person[i].art>0&&person[i].test>80) {person[i].money=person[i].money+8000;}
		if(person[i].test>85&&person[i].term>80) {person[i].money=person[i].money+4000;}
		if(person[i].test>90) {person[i].money=person[i].money+2000;}
		if(person[i].test>85&&person[i].west=='Y') {person[i].money=person[i].money+1000;}
		if(person[i].term>80&&person[i].key=='Y') {person[i].money=person[i].money+850;}
		q=q+person[i].money;
	}
	for(i=0;i<=n-2;i++)
	{
	    k=i;
		for(j=i+1;j<=n-1;j++)
			if(person[j].money>person[k].money)
				k=j;
		temp=person[k]; person[k]=person[i];person[i]=temp;
	}
	printf("%s\n",person[0].name);
	printf("%d\n",person[0].money);
	printf("%d",q);
	return 0;
}


struct student
{
	char name[22];
	int qimo;
	int banji;
	char gan;
	char sheng;
	int num;
};
void main()
{
	int n,i,j=0,sum,tol=0,max=0;
	struct student t,*s;
	scanf("%d",&n);
	s=(struct student *)malloc(n*sizeof(struct student));
	for(i=0;i<n;i++)
	{ sum=0;
		scanf("%s %d %d %c %c %d",(*(s+i)).name,&(*(s+i)).qimo,&(*(s+i)).banji,&(*(s+i)).gan,&(*(s+i)).sheng,&(*(s+i)).num);
      if (((*(s+i)).qimo>80)&&((*(s+i)).num>=1))  sum=sum+8000;
	  if (((*(s+i)).qimo>85)&&((*(s+i)).banji>80))  sum=sum+4000;
	  if ((*(s+i)).qimo>90)  sum=sum+2000;
	  if (((*(s+i)).qimo>85)&&((*(s+i)).sheng=='Y'))  sum=sum+1000;
	  if (((*(s+i)).banji>80)&&((*(s+i)).gan=='Y'))  sum=sum+850;
	  if(sum>max)   {max=sum;j=i;}
	  tol=tol+sum;
	}
	printf("%s\n%d\n%d\n",(*(s+j)).name,max,tol);
}


	struct point
	{
		char a[20];
		int x;
		int y;
		char xue;
		char xi;
		int z;
		int sum;
	};

int main(int argc, char* argv[])
{
	int n,i,max=0,m=0,gong=0;
	scanf("%d",&n);

	struct point *s;
	s=(struct point*)malloc(sizeof(struct point)*n);

	for(i=0;i<n;i++)
	{
		s[i].sum=0;
		scanf("%s %d %d %c %c %d",s[i].a,&s[i].x,&s[i].y,&s[i].xue,&s[i].xi,&s[i].z);
	}

	for(i=0;i<n;i++)
	{
		if(s[i].x>80&&s[i].z>=1) s[i].sum=s[i].sum+8000;
		if(s[i].x>85&&s[i].y>80) s[i].sum=s[i].sum+4000;
		if(s[i].x>90) s[i].sum=s[i].sum+2000;
		if(s[i].x>85&&s[i].xi=='Y') s[i].sum=s[i].sum+1000;
		if(s[i].y>80&&s[i].xue=='Y') s[i].sum=s[i].sum+850;
	}

	for(i=0;i<n;i++)
	{
		if(s[i].sum>max)
		{max=s[i].sum;m=i;}
	}

	printf("%s\n",s[m].a);
	printf("%d\n",max);

	for(i=0;i<n;i++)
	{
		gong=gong+s[i].sum;

	}
	printf("%d\n",gong);

	free (s);
	return 0;
}


struct student
{
	char name[20];
	int fs;
	int cs;
	char gb;
	char xb;
	int paper;
	int sch;
}stu[100];
int ys(int a,int b);
int ws(int a,int b);
int cj(int a);
int xibu(int a,char b);
int bj(int a,char b);
int main()
{
	int n=0,i=0,sum=0,k=0,j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].fs,&stu[i].cs,&stu[i].gb,&stu[i].xb,&stu[i].paper);
		stu[i].sch=0;
	}
	for(i=0;i<n;i++)
	{
		if(ys(stu[i].fs,stu[i].paper)==1)
		{
			stu[i].sch+=8000;
			sum+=8000;
		}
		if(ws(stu[i].fs,stu[i].cs)==1)
		{
			stu[i].sch+=4000;
			sum+=4000;
		}
		if(cj(stu[i].fs)==1)
		{
			stu[i].sch+=2000;
			sum+=2000;
		}
		if(xibu(stu[i].fs,stu[i].xb)==1)
		{
			stu[i].sch+=1000;
			sum+=1000;
		}
		if(bj(stu[i].cs,stu[i].gb)==1)
		{
			stu[i].sch+=850;
			sum+=850;
		}
	}
	k=stu[0].sch;
	for(i=0;i<n;i++)
	{
		if(k<stu[i].sch)
		{
			j=i;
			k=stu[i].sch;
		}
	}
	printf("%s\n%d\n%d",stu[j].name,stu[j].sch,sum);
	return 0;
}
int ys(int a,int b)
{
	if(a>80&&b>=1)
	{return 1;}
	else return 0;
}
int ws(int a,int b)
{
	if(a>85&&b>80)
	{return 1;}
	else return 0;
}
int cj(int a)
{
	if(a>90)
	{return 1;}
	else return 0;
}
int xibu(int a,char b)
{
	if(a>85&&b=='Y')
	{return 1;}
	else return 0;
}
int bj(int a,char b)
{
	if(a>80&&b=='Y')
	{return 1;}
	else return 0;
}


struct info
{
	char name[20];
	int final;
	int ass;
	char gan;
	char west;
	int paper;
    struct info *next;
};
struct info *create(int n)
{
    struct info *p1,*p2,*head;
	int i;
	p1=(struct info*)malloc(sizeof(struct info));
	scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->ass,&p1->gan,&p1->west,&p1->paper);
    p1->next=NULL;
	head=p1;
	p2=p1;
    for(i=1;i<n;i++)
	{
		p1=(struct info*)malloc(sizeof(struct info));
	    scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->ass,&p1->gan,&p1->west,&p1->paper);
        p1->next=NULL;
		p2->next=p1;
		p2=p1;
	}
	return head;
}
int main()
{
	int n;
	struct info *head;
	struct info *p1;
	int i,m,sum,max;
	char namemax[22];
	scanf("%d",&n);
	head=create(n);

	p1=head;
	sum=0;
	max=0;

	for(i=0;i<n;i++)
	{
	m=0;
	if(p1->final>80&&p1->paper>=1)
	{m+=8000;}
	if(p1->final>85&&p1->ass>80)
	{m+=4000;}
	if(p1->final>90)
	{m+=2000;}
    if(p1->final>85&&p1->west=='Y')
	{m+=1000;}
	if(p1->ass>80&&p1->gan=='Y')
	{m+=850;}
	if(m>max)
	{max=m;strcpy(namemax,p1->name);}
	p1=p1->next;
	}
    p1=head;
	for(m=0,i=0;i<n;i++)
	{
	if(p1->final>80&&p1->paper>=1)
	{m+=8000;}
	if(p1->final>85&&p1->ass>80)
	{m+=4000;}
	if(p1->final>90)
	{m+=2000;}
    if(p1->final>85&&p1->west=='Y')
	{m+=1000;}
	if(p1->ass>80&&p1->gan=='Y')
	{m+=850;}
	p1=p1->next;
	}
    sum=m;
	printf("%s\n%d\n%d\n",namemax,max,sum);
}


int main()
{
 int N;
 scanf("%d",&N);
 struct std
 {
  char name[21];
  int pin;
  int yi;
  char gan;
  char west;
  int n;
 }std[100];
 int i;
 for(i=0;i<N;i++)
 {
  scanf("%s %d %d %c %c %d",std[i].name,&std[i].pin,&std[i].yi,&std[i].gan,&std[i].west,&std[i].n);
 }
 int sum[100];
 for(i=0;i<N;i++)
  sum[i]=0;
 for(i=0;i<N;i++)
 {
  if(std[i].pin>80&&std[i].n>0)
   sum[i]+=8000;
  if(std[i].pin>85&&std[i].yi>80)
   sum[i]+=4000;
  if(std[i].pin>90)
   sum[i]+=2000;
  if(std[i].pin>85&&std[i].west=='Y')
   sum[i]+=1000;
  if(std[i].yi>80&&std[i].gan=='Y')
   sum[i]+=850;
 }
 int max=sum[0],k=0,he=sum[0];
 for(i=1;i<N;i++)
 {
  he+=sum[i];
  if(max<sum[i])
  {
   max=sum[i];
   k=i;
  }
 }
 printf("%s\n",std[k].name);
 printf("%d\n",max);
 printf("%d\n",he);
 return 0;
}


struct student
{
    char name[25];
    int qimo;
    int pingshi;
    char ganbu;
    char xibu;
    int lunwen;
    int money;
};
int jiangxuejin(struct student s);

int main(int argc, char* argv[])
{
	struct student a[101];
	int N,sum,max,MAX;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].qimo,&a[i].pingshi,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
		a[i].money=jiangxuejin(a[i]);
	}
	sum=max=0;
	MAX=0;
	for(int j=0;j<N;j++)
	{
		if(a[j].money>max)
		{
			max=a[j].money;
			MAX=j;
		}
		sum+=a[j].money;
	}
	printf("%s\n",a[MAX].name);
	printf("%d\n",max);
	printf("%d\n",sum);
	return 0;
}

int jiangxuejin(struct student s)
{
	int sum=0;
	if((s.qimo>80)&&(s.lunwen>=1))
	{
		sum+=8000;
	}
	if((s.qimo>85)&&(s.pingshi>80))
	{
		sum+=4000;
	}
	if(s.qimo>90)
	{
		sum+=2000;
	}
	if((s.xibu=='Y')&&(s.qimo>85))
	{
		sum+=1000;
	}
	if((s.pingshi>80)&&(s.ganbu=='Y'))
	{
		sum+=850;
	}
	return sum;
}


struct student
{
	char name[21];
	short finalscore;
	short clascore;
	char position;
	char westen;
	short essaynum;
	int reward;

}
;
int main()
{
	int nstu=4;
	int total=0;
	scanf("%d",&nstu);
	struct student *p=(struct student*)malloc(nstu*sizeof(struct student));
	int i;
	for(i=0;i<nstu;i++)
	{
		scanf("%s",p[i].name);
		scanf("%d",&(p[i].finalscore));
		scanf("%d ",&(p[i].clascore));
		scanf("%c ",&p[i].position);
		scanf("%c",&p[i].westen);
		scanf("%d",&(p[i].essaynum));
		p[i].reward=0;
	}
	for(i=0;i<nstu;i++)
	{
		if(p[i].finalscore>80&&p[i].essaynum>0)
			(p[i].reward)+=8000;
		if(p[i].finalscore>85&&p[i].clascore>80)
			(p[i].reward)+=4000;
		if(p[i].finalscore>90)
			(p[i].reward)+=2000;
		if(p[i].westen=='Y'&&p[i].finalscore>85)
			(p[i].reward)+=1000;
		if(p[i].position=='Y'&&p[i].clascore>80)
			(p[i].reward)+=850;
	}
	int money=p[0].reward;
	for(i=0;i<nstu-1;i++)
	{
		if(money<p[i+1].reward)
			money=(p[i+1].reward);
		total+=(p[i].reward);
	}
	total+=(p[nstu-1].reward);
	int j;
	for(j=0;j<nstu;j++)
	{
		if(p[j].reward==money)
			break;
	}
	printf("%s\n",p[j].name);
	printf("%d\n",p[j].reward);
	printf("%d\n",total);
	return 0;
}


struct student
{
 char name[20];
 int score;
 int ping;
 char gan;
 char xi;
 int lun;
 int jiang;
 }stu[100];

int main()
{
 int n,i,t,h=0;scanf("%d",&n);
 for(i=0;i<n;i++)
    {
         scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].score,
		&stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].lun);
	stu[i].jiang=0;
if(stu[i].score>80&&stu[i].lun>0)stu[i].jiang=stu[i].jiang+8000;
if(stu[i].score>85&&stu[i].ping>80)stu[i].jiang=stu[i].jiang+4000;
if(stu[i].score>90)stu[i].jiang=stu[i].jiang+2000;
if(stu[i].score>85&&stu[i].xi=='Y')stu[i].jiang=stu[i].jiang+1000;
if(stu[i].ping>80&&stu[i].gan=='Y')stu[i].jiang=stu[i].jiang+850;
}for(i=0,t=stu[0].jiang;i<n-1;i++)
{h=h+stu[i].jiang;if(stu[i+1].jiang>t)t=stu[i+1].jiang;}
for(i=0;i<n;i++)
if(stu[i].jiang==t){printf("%s\n%d\n%d",stu[i].name,t,h+stu[n-1].jiang);break;}
return 0;

}


struct Student
{char name[20];
 int a;
 int b;
 char c;
 char d;
 int e;
 int f;
};
int main()
{
	int n,i,k,m,t;
	scanf ("%d",&n);
	struct Student stu[200];
	for (i=0;i<n;i++)
	{
		scanf ("%s %d %d %c %c %d",stu[i].name,&stu[i].a,&stu[i].b,&stu[i].c,&stu[i].d,&stu[i].e);
	    stu[i].f=0;
	}
	for (i=0,m=0;i<n;i++)
	{
		if (stu[i].a>80&&stu[i].e>0)
			stu[i].f=stu[i].f+8000;
		if (stu[i].a>85&&stu[i].b>80)
			stu[i].f=stu[i].f+4000;
		if (stu[i].a>90)
			stu[i].f=stu[i].f+2000;
		if (stu[i].a>85&&stu[i].d=='Y')
			stu[i].f=stu[i].f+1000;
		if (stu[i].b>80&&stu[i].c=='Y')
			stu[i].f=stu[i].f+850;
		if (stu[i].f>m)
		{
			m=stu[i].f;
		    t=i;
		}
	}
	for (i=0,k=0;i<n;i++)
		k=k+stu[i].f;
	printf ("%s\n%d\n%d\n",stu[t].name,m,k);
	return 0;
}


int main()
{
    int n;
    int i;
    scanf("%d", &n);
    struct student
    {
           char name[1000];
           int final;
           int clas;
           char ganbu;
           char west;
           int paper;
    }stu[1000];

    for(i=1;i<=n;i++)
    {
                    scanf("%s %d %d %c %c %d", stu[i].name, &stu[i].final, &stu[i].clas, &stu[i].ganbu, &stu[i].west, &stu[i].paper);
    }
    int total[1000]={0};
    for(i=1;i<=n;i++)
    {
                     if(stu[i].final>80&&stu[i].paper>=1)
                     {
                                                         total[i]=total[i]+8000;
                     }
                     if(stu[i].final>85&&stu[i].clas>80)
                     {
                                                        total[i]=total[i]+4000;
                     }
                     if(stu[i].final>90)
                     {
                                                         total[i]=total[i]+2000;
                     }
                     if(stu[i].final>85&&stu[i].west=='Y')
                     {
                                                          total[i]=total[i]+1000;
                     }
                     if(stu[i].clas>80&&stu[i].ganbu=='Y')
                     {
                                                          total[i]=total[i]+850;
                     }

    }

    int max=total[1];
    int sum=total[1];
    int k;
    for(i=2;i<=n;i++)
    {
                     sum=sum+total[i];
                     if(total[i]>max)
                     {
                                     max=total[i];
                     }
    }
    for(i=1;i<=n;i++)
    {
                     if(total[i]==max)
                     {
                                      printf("%s\n", stu[i].name);
                                      break;
                     }
    }
    printf("%d\n", max);
    printf("%d", sum);

    return 0;
}


void main()
{
	struct student
	{
		char num[21];
		int scor1;
		int scor2;
		char g;
		char x;
		int lun;
		int ss;
	}stu[100];
	int i,n,sum=0;
	struct student max;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].num,&stu[i].scor1,&stu[i].scor2,&stu[i].g,&stu[i].x,&stu[i].lun);
		stu[i].ss=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].scor1>80&&stu[i].lun>0)
			stu[i].ss+=8000;

		if(stu[i].scor1>85&&stu[i].scor2>80)
			stu[i].ss+=4000;

		if(stu[i].scor1>90)
			stu[i].ss+=2000;

		if(stu[i].scor1>85&&stu[i].x=='Y')
			stu[i].ss+=1000;

		if(stu[i].scor2>80&&stu[i].g=='Y')
			stu[i].ss+=850;
	}

	max=stu[0];
	for(i=0;i<n;i++)
	{
		if(stu[i].ss>max.ss)
			max=stu[i];
		sum+=stu[i].ss;
	}
	printf("%s\n",max.num);
	printf("%d\n",max.ss);
	printf("%d\n",sum);
}


int main(){
    int n , i , p = 0 , sum = 0 , q;
	struct student{
		char name[200];
		int c1 , c2 , wx , wa;
		char bg , xb ;
	}stu[101];
	scanf("%d" , &n);
	for( i = 0 ; i <= n - 1; i++){
		stu[i].wa = 0 ;
		scanf("%s %d %d %c %c %d", stu[i].name , &stu[i].c1 , &stu[i].c2 ,  &stu[i].bg , &stu[i].xb , &stu[i].wx);
//			printf("%s %d %d %c %c %d\n", stu[i].name , stu[i].c1 , stu[i].c2 ,  stu[i].bg , stu[i].xb , stu[i].wx);
		if( stu[i].c1 > 80 && stu[i].wx != 0 ) stu[i].wa = stu[i].wa + 8000 ;
		if( stu[i].c1 > 85 && stu[i].c2 > 80 ) stu[i].wa = stu[i].wa + 4000 ;
		if( stu[i].c1 > 90 ) stu[i].wa = stu[i].wa + 2000;
		if( stu[i].c1 > 85 && stu[i].xb == 'Y' ) stu[i].wa = stu[i].wa + 1000;
		if( stu[i].c2 > 80 && stu[i].bg == 'Y' ) stu[i].wa = stu[i].wa + 850 ;
		if( stu[i].wa > p ) {p = stu[i].wa ;q = i ;}
		sum = sum + stu[i].wa ;
//			printf("wa%d\n %d\n" , stu[i].wa , q);
	}
	printf("%s\n%d\n%d\n" , stu[q].name , stu[q].wa , sum);

    return(0);

}


struct Student{
	char name[20];
	int mark;
	int classpoint;
	char leader;
	char west;
	int paper;
	int money;
};
void main(){
	int i,n,maxnum,tot=0;
	struct Student stu[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].mark,&stu[i].classpoint,&stu[i].leader,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{if(stu[i].mark>80&&stu[i].paper>0) stu[i].money=stu[i].money+8000;
	if(stu[i].mark>85&&stu[i].classpoint>80) stu[i].money=stu[i].money+4000;
	if(stu[i].mark>90) stu[i].money=stu[i].money+2000;
	if(stu[i].mark>85&&(stu[i].west=='Y')) stu[i].money=stu[i].money+1000;
	if(   stu[i].leader=='Y'&&(stu[i].classpoint>80) )stu[i].money=stu[i].money+850;
	}
	maxnum=0;
    for(i=1;i<n;i++)
		if(stu[maxnum].money<stu[i].money) maxnum=i;
	for(i=0;i<n;i++)
		tot=tot+stu[i].money;
	printf("%s\n%d\n%d",stu[maxnum].name,stu[maxnum].money,tot);
}


struct student{
	char name[21];
	int qimo;
	int banji;
	char ganbu;
	char west;
	int article;
	int total;
};

int main(){
	int n,i,max,sum;

	scanf("%d",&n);

	struct student *stu=(struct student *)malloc(sizeof(int)*4*n+sizeof(char)*23*n);

	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].west,&stu[i].article);
		stu[i].total =0;
	}

	for(i=0;i<n;i++){
		if(stu[i].qimo>80&&stu[i].article>0){
			stu[i].total +=8000;
		}
		if(stu[i].qimo>85&&stu[i].banji>80){
			stu[i].total +=4000;
		}
		if(stu[i].qimo>90){
			stu[i].total+=2000;
		}
		if(stu[i].qimo >85&&stu[i].west=='Y'){
			stu[i].total +=1000;
		}
		if(stu[i].banji >80&&stu[i].ganbu =='Y'){
			stu[i].total +=850;
		}
	}
	max=stu[0].total ;
	sum=0;
	for(i=0;i<n;i++){
		if(stu[i].total>max){
			max=stu[i].total ;
		}
		sum+=stu[i].total ;
	}
	for(i=0;i<n;i++){
		if(max==stu[i].total){
			printf("%s\n%d\n%d\n",stu[i].name,max,sum);
			break;
		}
	}

	return 0;

}


struct scholarship
{
	char name[20];
	int avscore;
	int clscore;
	char ganbu;
	char xibu;
	int paper;
}stu[100];
void main()
{
int n,i,b[100]={0},c=0,d=0,all=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
	scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].avscore,&stu[i].clscore,&stu[i].ganbu,&stu[i].xibu,&stu[i].paper);
	if(stu[i].avscore>80&&stu[i].paper>0)
		b[i]=b[i]+8000;
	if(stu[i].avscore>85&&stu[i].clscore>80)
		b[i]=b[i]+4000;
	if(stu[i].avscore>90)
		b[i]=b[i]+2000;
	if(stu[i].avscore>85&&stu[i].xibu=='Y')
		b[i]=b[i]+1000;
	if(stu[i].ganbu=='Y'&&stu[i].clscore>80)
		b[i]=b[i]+850;
	if(i>0&&b[i]>c)
	{
		c=b[i];
		d=i;
	}
	else if(i==0)
		c=b[0];
}
for(i=0;i<n;i++)
all=all+b[i];

printf("%s\n%d\n%d\n",stu[d].name,c,all);

}


struct
{
	char name[20];
	int qimo;
	int banji;
	char gb;
	char xb;
	int paper;
}stu[101];

void main()
{
	int N, i, max=0, p=0, total=0, sch[101]={0};
	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].gb,&stu[i].xb,&stu[i].paper);
	for(i=0;i<N;i++)
	{
		if(stu[i].qimo>80&&stu[i].paper>0)
			sch[i]+=8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			sch[i]+=4000;
		if(stu[i].qimo>90)
			sch[i]+=2000;
		if(stu[i].qimo>85&&stu[i].xb=='Y')
			sch[i]+=1000;
		if(stu[i].banji>80&&stu[i].gb=='Y')
			sch[i]+=850;
	}
	max=0;
	for(i=0;i<N;i++)
	{
		if(sch[i]>max)
		{
			max=sch[i];
			p=i;
		}
		total=total+sch[i];
	}
	printf("%s\n%d\n%d\n",stu[p].name,sch[p],total);
}


struct student
{
	char name[20];
	int score;
	int value;
	char cadre;
	char west;
	int paper;
	int sum;
};
int deal(struct student stu)
{
	stu.sum=0;
	if(stu.score>80&&stu.paper>0)
		stu.sum+=8000;
	if(stu.score>85&&stu.value>80)
		stu.sum+=4000;
	if(stu.score>90)
		stu.sum+=2000;
	if(stu.score>85&&stu.west=='Y')
		stu.sum+=1000;
	if(stu.value>80&&stu.cadre=='Y')
		stu.sum+=850;
	return(stu.sum);
}
void main()
{
	int n,i,total=0,top=0,t=0;
	scanf("%d",&n);
	struct student stu[100];
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].score,&stu[i].value,&stu[i].cadre,&stu[i].west,&stu[i].paper);
	stu[i].sum=deal(stu[i]);total+=stu[i].sum;
	if(stu[i].sum>top)
	{top=stu[i].sum;t=i;}
	}
	printf("%s\n%d\n%d",stu[t].name,top,total);
}


struct student
{
char name[35];
int final;
int score;
char leader;
char west;
int paper;
int money;
struct student *next;
};

struct student *creat(void)
{
struct student *p,*q,*head;
int n,i=0;
scanf("%d",&n);

head=(struct student*)malloc(sizeof (struct student));
scanf("%s %d %d %c %c %d",&head->name,&head->final,&head->score,&head->leader,&head->west,&head->paper);
q=head;
p=head;

for(i=0;i<n;i++)
{
q=p;
q->money=0;
if ((q->final>80)&&(q->paper>0)) q->money=q->money+8000;
if ((q->final>85)&&(q->score>80)) q->money=q->money+4000;
if (q->final>90) q->money=q->money+2000;
if ((q->final>85)&&(q->west=='Y')) q->money=q->money+1000;
if ((q->score>80)&&(q->leader=='Y')) q->money=q->money+850;

if(i<n-1)
{p=(struct student*)malloc(sizeof (struct student));
scanf("%s %d %d %c %c %d",&p->name,&p->final,&p->score,&p->leader,&p->west,&p->paper);
q->next=p;}
}

q->next=NULL;
return(head);
}

void main()
{
struct student *p,*q,*r;
int sum=0,max=0;
p=creat();

for(q=p;q!=NULL;)
{if (q->money>max) {max=q->money; r=q;}
sum=sum+q->money;
q=q->next;
}

printf("%s\n%d\n",r->name,r->money);
printf("%d",sum);
}


int main()
{
	int N,fgrade[101],cgrade[101],lunwen[101],jiang[101],max=0,x,sum=0;
	cin>>N;
	cin.get();
	char name[101][20],ganbu[101],xibu[101];
	for(int i=1;i<=N;i++)
	{
		cin>>name[i]>>fgrade[i]>>cgrade[i]>>ganbu[i]>>xibu[i]>>lunwen[i];

	}
	for(int i=1;i<=N;i++)
	{
		jiang[i]=(fgrade[i]>80&&lunwen[i]>=1)*8000+(fgrade[i]>85&&cgrade[i]>80)*4000+(fgrade[i]>90)*2000+
			     (fgrade[i]>85&&xibu[i]=='Y')*1000+(cgrade[i]>80&&ganbu[i]=='Y')*850;
		sum=sum+jiang[i];
		if(max<jiang[i])
		{
			max=jiang[i];
		    x=i;
		}
	}
cout<<name[x]<<endl<<jiang[x]<<endl<<sum<<endl;
return 0;
}


struct student
{
	char name[20];
	int score1;
	int score2;
	char lead;
	char west;
	int paper;
	int sch;
	struct student *next;
};
void main()
{
	struct student *p0,*p1,*p2,*head;
	int n,k,i;
	scanf("%d",&n);
	p1=(struct student *)malloc(sizeof(struct student));
	p1->sch=0;
	scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->lead,&p1->west,&p1->paper);
	if((p1->score1>80)&&(p1->paper>0))
		p1->sch=p1->sch+8000;
	if((p1->score1>85)&&(p1->score2>80))
		p1->sch=p1->sch+4000;
	if(p1->score1>90)
		p1->sch=p1->sch+2000;
	if((p1->score1>85)&&(p1->west=='Y'))
		p1->sch=p1->sch+1000;
	if((p1->score2>80)&&(p1->lead=='Y'))
		p1->sch=p1->sch+850;
	head=p1;
	p1->next=NULL;
	for(i=1;i<n;i++)
	{
		p1=head;
		p0=(struct student *)malloc(sizeof(struct student));
		scanf("%s %d %d %c %c %d",p0->name,&p0->score1,&p0->score2,&p0->lead,&p0->west,&p0->paper);
		p0->sch=0;
		if((p0->score1>80)&&(p0->paper>0))
			p0->sch=p0->sch+8000;
		if((p0->score1>85)&&(p0->score2>80))
			p0->sch=p0->sch+4000;
		if(p0->score1>90)
			p0->sch=p0->sch+2000;
		if((p0->score1>85)&&(p0->west=='Y'))
			p0->sch=p0->sch+1000;
		if((p0->score2>80)&&(p0->lead=='Y'))
			p0->sch=p0->sch+850;
		while((p0->sch<=p1->sch)&&(p1->next!=NULL))
		{
			p2=p1;
			p1=p1->next;
		}
		if(p0->sch>p1->sch)
		{
			if(head==p1)
				head=p0;
			else p2->next=p0;
			p0->next=p1;
		}
		else
		{
			p1->next=p0;
			p0->next=NULL;
		}
	}
	k=0;
	p1=head;
	while(p1!=NULL)
	{
		k=k+p1->sch;
		p1=p1->next;
	}
	printf("%s\n%d\n%d",head->name,head->sch,k);
}


struct student
{
	char name[20];
	int end;
	int clas;
	char leader;
	char west;
	int paper;
	struct student *next;
};
int main()
{
	struct student *p,*q,*head;
	char *a;
	int *b,*c;
	int n,i,max=0;
	long int sum=0;
	scanf("%d\n",&n);
	head=p=q=(struct student *)malloc(LEN);
	a=(char*)malloc(20*sizeof(char));
	b=c=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d\n",p->name,&p->end,&p->clas,&p->leader,&p->west,&p->paper);
		p=(struct student *)malloc(LEN);
		q->next=p;
		q=p;
	}
	q->next=NULL;
	q=p=head;
	for(i=0;i<n;i++)
	{
		if(((p->end)>80)&&((p->paper)>0))*b+=8000;
		if(((p->end)>85)&&((p->clas)>80))*b+=4000;
		if((p->end)>90)*b+=2000;
		if(((p->end)>85)&&((p->west)=='Y'))*b+=1000;
		if(((p->clas)>80)&&((p->leader)=='Y'))*b+=850;
		b++;
		p=q->next;
		q=p;
	}
	q=p=head;
	b=c;
	for(i=0;i<n;i++)
	{
		if(*b>max)
		{
			max=*b;
			strcpy(a,p->name);
		}
		sum+=*b;
		b++;
		p=q->next;
		q=p;
	}
	printf("%s\n%d\n%ld\n",a,max,sum);
}


	struct student
	{
		char name[21];
		int gpa;
		int c_gpa;
		char official;
		char west;
		int paper;
	};

void main()
{
	int process( struct student *p);

	struct student stu[100],*p,*P=NULL;
	int i=0,n,TOTAL=0,max=0,MAX=0;

	p=stu;
	scanf("%d\n",&n);
	for(i;i<n;i++)
	{

		scanf("%s %d %d %c %c %d",p->name,&p->gpa,&p->c_gpa,&p->official,&p->west,&p->paper);
		max=process(p++);
		if(max>MAX) {MAX=max;P=p-1;}
		TOTAL += max;
	}

	printf("%s\n%d\n%d", P->name,MAX,TOTAL);

}

int process( struct student *p)
{
	int prize=0;
	if (p->gpa>80 && p->paper>=1) prize += 8000;
	if (p->gpa>85 && p->c_gpa>80) prize += 4000;
	if (p->gpa>90) prize += 2000;
	if (p->gpa>85 && p->west=='Y') prize += 1000;
	if (p->c_gpa>80 && p->official=='Y') prize +=850;
	return prize;
}


struct student
{
	char name[30];
	int sco;
	int pin;
	char gan;
	char xi;
	int lun;
};
struct student stu[100];
void main()
{
	int i,j,k,m,n,a[100],sum=0,t,add=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco,&stu[i].pin,&stu[i].gan,&stu[i].xi,&stu[i].lun);
		a[i]=0;
	}
	for(i=1;i<=n;i++)
	{
		if(stu[i].sco>80&&stu[i].lun>=1)
			a[i]=a[i]+8000;
		if(stu[i].sco>85&&stu[i].pin>80)
			a[i]=a[i]+4000;
		if(stu[i].sco>90)
			a[i]=a[i]+2000;
		if(stu[i].sco>85&&stu[i].xi=='Y')
			a[i]=a[i]+1000;
		if(stu[i].pin>80&&stu[i].gan=='Y')
			a[i]=a[i]+850;
	}
	for(i=1;i<=n;i++)
	{
		if(sum<a[i])
			sum=a[i];
	}
	for(i=1;i<=n;i++)
	{
		if(a[i]==sum)
		{
			t=i;break;
		}

	}
	for(i=1;i<=n;i++)
	{add=add+a[i];}

	printf("%s\n%d\n%d",stu[t].name,sum,add);

}


int main()
{
	struct std{
		char name[20];
		int qm,bp,lw,jj;
		char gb,xb;
	}stu[200];
	int n,i,s=0,max;
	char mn[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		stu[i].jj=0;
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qm,&stu[i].bp,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		if(stu[i].qm>80&&stu[i].lw>0){stu[i].jj+=8000;}
		if(stu[i].qm>85&&stu[i].bp>80){stu[i].jj+=4000;}
		if(stu[i].qm>90){stu[i].jj+=2000;}
		if(stu[i].qm>85&&stu[i].xb=='Y'){stu[i].jj+=1000;}
		if(stu[i].bp>80&&stu[i].gb=='Y'){stu[i].jj+=850;}
		s=s+stu[i].jj;
	}
	max=stu[0].jj;
	strcpy(mn,stu[0].name);
	for(i=0;i<n;i++)
	{
		if(max<stu[i].jj)
		{
			max=stu[i].jj;
			strcpy(mn,stu[i].name);
		}
	}
	printf("%s\n%d\n%d",mn,max,s);
	return 0;
}


struct student
{
       char name[40];
       int end;
       int cls;
       int lead;
       int west;
       int paper;
       int money;
} stu[100];

int main()
{
    int i,n,t=1,sum=0,max=0,print;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
                     scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].end,&stu[i].cls,&stu[i].lead,&stu[i].west,&stu[i].paper);
    }

    for(i=1;i<=n;i++)
    {
                     if(stu[i].end>80&&stu[i].paper>=1) stu[i].money+=8000;
                     if(stu[i].end>85&&stu[i].cls>80) stu[i].money+=4000;
                     if(stu[i].end>90) stu[i].money+=2000;
                     if(stu[i].end>85&&stu[i].west==89) stu[i].money+=1000;
                     if(stu[i].cls>80&&stu[i].lead==89) stu[i].money+=850;
                     sum+=stu[i].money;
    }
    for(i=1;i<=n;i++)
    {
                    if(stu[i].money>max)
                    {
                                         max=stu[i].money;
                                         print=i;
                    }
    }

printf("%s\n%d\n%d",stu[print].name,stu[print].money,sum);

    return 0;
}


int main()
{
	struct student
	{
		char name[20];
		int a;
		int b;
		char c;
		char d;
		int e;
		struct student*next;
	}student[100];
	int N,i,money[100],max,sum,flag;
	max=sum=0;
	for(i=0;i<100;i++)
	{
		money[i]=0;
	}
	struct student *p;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		student[i].next=&student[i+1];
	}
	student[N-1].next=NULL;
	p=&student[0];
	i=0;
	while(p!=NULL)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->a,&p->b,&p->c,&p->d,&p->e);
		if((p->a)>80&&(p->e)>0)
			money[i]+=8000;
		if((p->a)>85&&(p->b)>80)
			money[i]+=4000;
		if((p->a)>90)
			money[i]+=2000;
		if((p->a)>85&&(p->d)=='Y')
			money[i]+=1000;
		if((p->b)>80&&(p->c)=='Y')
			money[i]+=850;
		i++;
		p=p->next;
	}
	for(i=0;i<N;i++)
	{
		if(money[i]>max)
		{
			max=money[i];
			flag=i;
		}
	}
	printf("%s\n",student[flag].name);
	printf("%d\n",max);
	for(i=0;i<N;i++)
	{
		sum+=money[i];
	}
	printf("%d",sum);
	return 0;
}


    struct Student{
        char name[21];
        int avg;
        int cls;
        char off;
        char west;
        int paper;
        };

int main()
{
    int i,j,N,high;
    long sch[100]={0};
    long schtot=0;
    char c;
    struct Student ptcpt[100];
    struct Student tmp;
        scanf("%d",&N);
    for (i=0;i<N-1;i++){
        j=0;
        while (j<22&&(c=getchar())!=' '){
            ptcpt[i].name[j]=c;
            j++;
            }
            ptcpt[i].name[j]='\0';
        scanf(" %d %d %c %c %d\n",&ptcpt[i].avg,&ptcpt[i].cls,&ptcpt[i].off,&ptcpt[i].west,&ptcpt[i].paper);
        if (ptcpt[i].avg>80&&ptcpt[i].paper>=1){
        sch[i]=sch[i]+8000;}
        if (ptcpt[i].avg>85&&ptcpt[i].cls>80){
        sch[i]=sch[i]+4000;}
        if (ptcpt[i].avg>90){
        sch[i]=sch[i]+2000;}
        if (ptcpt[i].avg>85&&ptcpt[i].west=='Y'){
        sch[i]=sch[i]+1000;}
        if (ptcpt[i].cls>80&&ptcpt[i].off=='Y'){
        sch[i]=sch[i]+850;}

        schtot=schtot+sch[i];
        }

        j=0;
        while (j<22&&(c=getchar())!=' '){
            ptcpt[N-1].name[j]=c;
            j++;
            }
            ptcpt[N-1].name[j]='\0';
        scanf(" %d %d %c %c %d",&ptcpt[N-1].avg,&ptcpt[N-1].cls,&ptcpt[N-1].off,&ptcpt[N-1].west,&ptcpt[N-1].paper);
        if (ptcpt[N-1].avg>80&&ptcpt[N-1].paper>=1) {
            sch[N-1]=sch[N-1]+8000;
        }
        if (ptcpt[N-1].avg>85&&ptcpt[N-1].cls>80){
        sch[N-1]=sch[N-1]+4000;}
        if (ptcpt[N-1].avg>90){
        sch[N-1]=sch[N-1]+2000;}
        if (ptcpt[N-1].avg>85&&ptcpt[N-1].west=='Y'){
        sch[N-1]=sch[N-1]+1000;}
        if (ptcpt[N-1].cls>80&&ptcpt[N-1].off=='Y'){
        sch[N-1]=sch[N-1]+850;}

        schtot=schtot+sch[N-1];
        strcpy(tmp.name,ptcpt[N-1].name);
                high=sch[N-1];

        for (i=N-1;i>-1;i--){
            if (high<=sch[i]){
                strcpy(tmp.name,ptcpt[i].name);
                high=sch[i];
                }
                else continue;
            }
        printf("%s\n%d\n%ld",tmp.name,high,schtot);
    return 0;
}


struct student{
	char name[20];
	int smark;
	int cmark;
	char lead;
	char west;
	int num;
};

struct student stu[200];
int s[100];
int n;

int js(int x)
{
	int reval=0;
	if (stu[x].smark>80&&stu[x].num>=1) reval+=8000;
	if (stu[x].smark>85&&stu[x].cmark>80) reval+=4000;
	if (stu[x].smark>90) reval+=2000;
	if (stu[x].smark>85&&stu[x].west=='Y') reval+=1000;
	if (stu[x].cmark>80&&stu[x].lead=='Y') reval+=850;
return reval;
}

int main()
{
	int maxnum=0,max=0,sum=0,i=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>stu[i].name>>stu[i].smark>>stu[i].cmark>>stu[i].lead>>stu[i].west>>stu[i].num;
	}
	for(i=0;i<n;i++)
	{
//		cout<<js(i)<<endl;
		sum+=js(i);
		if(js(i)>max){
			maxnum=i;
			max=js(i);
		}
	}
	cout<<stu[maxnum].name<<endl<<max<<endl<<sum<<endl;
	return 0;
}


void main()
{
	struct student
	{
		char name[30];
		int num1;
		int num2;
		char isstu;
		char iswest;
		int paper;
	}stu[100];
	int n,i,max,all=0;
	int reward[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		reward[i]=0;
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].num1,&stu[i].num2,&stu[i].isstu,&stu[i].iswest,&stu[i].paper);
	for(i=0;i<n;i++)
	{
		if(stu[i].num1>80&&stu[i].paper>=1)
			reward[i]=reward[i]+8000;
		if(stu[i].num1>85&&stu[i].num2>80)
			reward[i]=reward[i]+4000;
		if(stu[i].num1>90)
			reward[i]=reward[i]+2000;
		if(stu[i].num1>85&&stu[i].iswest=='Y')
			reward[i]=reward[i]+1000;
		if(stu[i].num2>80&&stu[i].isstu=='Y')
			reward[i]=reward[i]+850;
	}
	for(i=0;i<n;i++)
		all=all+reward[i];
	max=reward[0];
	for(i=1;i<n;i++)
		if(max<reward[i])
			max=reward[i];
	for(i=0;i<n;i++)
		if(max==reward[i])
			break;
	printf("%s\n%d\n%d\n",stu[i].name,reward[i],all);
}


struct student
{
	char name[20];
	int pingjun;
	int pingyi;
	char bgb[3];
	char xb[3];
    int lunwen;
	int qian;
};

int main()
{
	struct student stu[100]={{"\0"}};
	struct student total={"\0"};
	struct student temp={"\0"};
     int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d",stu[i].name,&stu[i].pingjun,&stu[i].pingyi);
			scanf("%s%s%d",&stu[i].bgb,&stu[i].xb,&stu[i].lunwen);

		if(stu[i].pingjun>80&&stu[i].lunwen>=1)
			stu[i].qian=stu[i].qian+8000;

		if(stu[i].pingjun>85&&stu[i].pingyi>80)
            stu[i].qian=stu[i].qian+4000;

		if(stu[i].pingjun>90)
            stu[i].qian=stu[i].qian+2000;

		if(stu[i].pingjun>85&&stu[i].xb[0]=='Y')
            stu[i].qian=stu[i].qian+1000;

		if(stu[i].pingyi>80&&stu[i].bgb[0]=='Y')
           stu[i].qian=stu[i].qian+850;
		total.qian=total.qian+stu[i].qian;

	}
	for(i=0;i<n;i++)
	{
		if(stu[i].qian>temp.qian)
			temp=stu[i];
	}

		printf("%s\n%d\n%d\n",temp.name,temp.qian,total.qian);
		return 0;
}


struct student
{
	char name[20];
	int gradeA;
	int gradeB;
	char a;
	char b;
	int num;
	int n;//??
	int np;//??
}
stu[100];
void main()
{
	int m,k,i,max;
	int total=0;
	scanf("%d\n",&m);
	for(i=0;i<m;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].gradeA,&stu[i].gradeB,&stu[i].a,&stu[i].b,&stu[i].num);
		stu[i].n=0;
		stu[i].np=0;
	}
	for(i=0;i<m;i++)
	{
		if(stu[i].gradeA>80&&stu[i].num>=1)
		{
			total=total+8000;
			stu[i].n++;
			stu[i].np=stu[i].np+8000;
		}
		if(stu[i].gradeA>85&&stu[i].gradeB>80)
		{
			total=total+4000;
			stu[i].n++;
			stu[i].np=stu[i].np+4000;
		}
		if(stu[i].gradeA>90)
		{
			total=total+2000;
            stu[i].n++;
			stu[i].np=stu[i].np+2000;
		}
		if(stu[i].gradeA>85&&stu[i].b=='Y')
		{
			total=total+1000;
            stu[i].n++;
			stu[i].np=stu[i].np+1000;
		}
		if(stu[i].gradeB>80&&stu[i].a=='Y')
		{
			total=total+850;
            stu[i].n++;
			stu[i].np=stu[i].np+850;
		}
	}
	for(i=0,max=0;i<m;i++)
		if(stu[i].np>max)
		{
			max=stu[i].np;
		}
	for(i=0;i<m;i++)
	{
		if(stu[i].np==max)
		{
			k=i;
		    break;
		}
	}
	printf("%s\n%d\n%d\n",stu[k].name,stu[k].np,total);
}


int main(int argc, char* argv[])
{
	int n;
	char name[100][50];
	int qimo[100];
	int banji[100];
	char ganbu[100];
	char xibu[100];
	int lunwen[100];
	int i=0,sum[100]={0},sumz=0,k=0;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",name[i],&qimo[i],&banji[i],&ganbu[i],&xibu[i],&lunwen[i]);
	}

	for(i=0;i<n;i++)
	{
		if(qimo[i]>80&&lunwen[i]>=1) sum[i]+=8000;
		if(qimo[i]>85&&banji[i]>80) sum[i]+=4000;
		if(qimo[i]>90) sum[i]+=2000;
		if(qimo[i]>85&&xibu[i]=='Y') sum[i]+=1000;
		if(banji[i]>80&&ganbu[i]=='Y') sum[i]+=850;
	}
	int summax=sum[0];
	for(i=1;i<n;i++)
	{
		sumz+=sum[i];
		if(sum[i]>summax)
		{
			summax=sum[i];
			k=i;
		}
	}
	sumz=sumz+sum[0];

	printf("%s\n%d\n%d\n",name[k],sum[k],sumz);

	return 0;
}


void main()
{
	struct stu
{char name[20];
int fen;
int pin;
char gan;
char sheng;
int lun;
int jiang;
}a[100];
	int n,i,max,k,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].fen,&a[i].pin,&a[i].gan,&a[i].sheng,&a[i].lun);
		a[i].jiang=0;
		if(a[i].fen>80&&a[i].lun>0)
			a[i].jiang=a[i].jiang+8000;
		if(a[i].fen>85&&a[i].pin>80)
			a[i].jiang=a[i].jiang+4000;
		if(a[i].fen>90)
			a[i].jiang=a[i].jiang+2000;
		if(a[i].fen>85&&a[i].sheng=='Y')
			a[i].jiang=a[i].jiang+1000;
		if(a[i].pin>80&&a[i].gan=='Y')
			a[i].jiang=a[i].jiang+850;
		sum=sum+a[i].jiang;
	}
	for(i=1,k=0,max=a[0].jiang;i<n;i++)
		if(a[i].jiang>max)
		{
			max=a[i].jiang;
			k=i;
		}
		printf("%s\n%d\n%d",a[k].name,a[k].jiang,sum);
}


int main()
{
	int i,n,smax=0;
	struct s{
		char name[21];
		int qimo;
		int banji;
		char bangan;
		char xibu;
		int lunwen;
		int sum;}s[101];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		s[i].sum=0;
		scanf("%s %d %d %c %c %d",s[i].name,&s[i].qimo,&s[i].banji,&s[i].bangan,&s[i].xibu,&s[i].lunwen);
	}
		for(i=0;i<n;i++){
		if((s[i].qimo>80)&&(s[i].lunwen>0))
			s[i].sum=s[i].sum+8000;
        if((s[i].qimo>85)&&(s[i].banji>80))
			s[i].sum=s[i].sum+4000;
        if(s[i].qimo>90)
			s[i].sum=s[i].sum+2000;
	    if((s[i].qimo>85)&&(s[i].xibu=='Y'))
			s[i].sum=s[i].sum+1000;
        if((s[i].banji>80)&&(s[i].bangan=='Y'))
			s[i].sum=s[i].sum+850;}
		for(i=0;i<n;i++)
		{smax+=s[i].sum;
			if(s[i].sum>s[0].sum){
				s[0].sum=s[i].sum;
			s[0]=s[i];	}
		}
		printf("%s\n",s[0].name);
		printf("%d\n",s[0].sum);
		printf("%d",smax);
		return 0;
	}


void main()
{
	struct stu
	{
		char name[20];
		int end;
		int cls;
		char lead;
		char west;
		int pap;
		int sum;
	}std[100];
	int n,i,j,summ=0,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d %d %c %c %d",&std[i].name,&std[i].end,&std[i].cls,&std[i].lead,&std[i].west,&std[i].pap);
		std[i].sum=0;
		if((std[i].end>80)&&(std[i].pap>=1))SS=SS+8000;
		if((S.end>85)&&(S.cls>80))SS=SS+4000;
		if(S.end>90)SS=SS+2000;
		if((S.end>85)&&(S.west=='Y'))SS=SS+1000;
		if((S.cls>80)&&(S.lead=='Y'))SS=SS+850;
		summ=summ+SS;
	}
	for(i=0;i<n;i++)
	{
		if(SS>k)
		{
			k=SS;
			j=i;
		}
	}
	printf("%s\n%d\n%d\n",std[j].name,std[j].sum,summ);
}


void main()
{
	struct information
	{
		char name[20];
		int qimo;
		int banji;
		char ganbu;
		char xibu;
		int lunwen;
		int money;
	}info[100];
	int n,max,sum=0,i;
	char scholar[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",info[i].name,&info[i].qimo,&info[i].banji,&info[i].ganbu,&info[i].xibu,&info[i].lunwen);
		info[i].money=0;
	}
	for(i=0;i<n;i++)
	{
		if(info[i].qimo>80&&info[i].lunwen>0)
			info[i].money+=8000;
		if(info[i].qimo>85&&info[i].banji>80)
			info[i].money+=4000;
		if(info[i].qimo>90)
			info[i].money+=2000;
		if(info[i].qimo>85&&info[i].xibu=='Y')
			info[i].money+=1000;
		if(info[i].banji>80&&info[i].ganbu=='Y')
			info[i].money+=850;
		sum+=info[i].money;
	}
	strcpy(scholar,info[0].name);
	max=info[0].money;
	for(i=0;i<n;i++)
	{
		if(max<info[i].money)
		{
			max=info[i].money;
			strcpy(scholar,info[i].name);
		}
	}
	printf("%s\n%d\n%d\n",scholar,max,sum);
}


struct student
{
	char name[20];
	int score;
	int pscore;
	char gjud;
	char wjud;
	int paper;
	int sum;
}stu[100];
void main()
{
	int n,i,ssum=0,tsum=0,ti;scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].score,&stu[i].pscore,&stu[i].gjud,&stu[i].wjud,&stu[i].paper),stu[i].sum=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].score>80&&stu[i].paper>=1)stu[i].sum+=8000;
		if(stu[i].score>85&&stu[i].pscore>80)stu[i].sum+=4000;
		if(stu[i].score>90)stu[i].sum+=2000;
		if(stu[i].score>85&&stu[i].wjud=='Y')stu[i].sum+=1000;
		if(stu[i].pscore>80&&stu[i].gjud=='Y')stu[i].sum+=850;
		ssum+=stu[i].sum;
	}
	for(i=0;i<n;i++)if(stu[i].sum>tsum)tsum=stu[i].sum,ti=i;
	printf("%s\n%d\n%d",stu[ti].name,tsum,ssum);
}


struct stu
{
	char name[21];
	int avs;
	int pys;
	char gb;
	char xb;
	int lw;
} stu[100];

main()
{
	int n,i,max,maxstu,sum;
	int jj[100];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].avs,&stu[i].pys,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		jj[i]=0;
		if(stu[i].avs>80&&stu[i].lw>0){
			jj[i]+=8000;
		}
		if(stu[i].avs>85&&stu[i].pys>80){
			jj[i]+=4000;
		}
		if(stu[i].avs>90){
			jj[i]+=2000;
		}
		if(stu[i].avs>85&&stu[i].xb=='Y'){
			jj[i]+=1000;
		}
		if(stu[i].pys>80&&stu[i].gb=='Y'){
			jj[i]+=850;
		}
	}

	max=jj[0];
	maxstu=0;
	sum=jj[0];
	for(i=1;i<n;i++){
		if(jj[i]>max){
			max=jj[i];
			maxstu=i;
		}
		sum+=jj[i];
	}

	printf("%s\n%d\n%d\n",stu[maxstu].name,max,sum);
}


int main()
{
	struct student
	{
		char nam[50];
		int ave;
		int ping;
		char gan;
		char xi;
		int wen;
		int total[5];

		int all;
	}stu[100];
	int num,i,j;
	int a[100]={0};
	scanf("%d",&num);
	for(i=0;i<num;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].nam,&stu[i].ave,&stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].wen);
stu[i].all = 0;
memset(stu[i].total, 0, sizeof(stu[i].total));
	}
    for(i=0;i<num;i++)
	{

		if(stu[i].ave>80&&stu[i].wen>=1)
			stu[i].total[0]=8000;
                if(stu[i].ave>85&&stu[i].ping>80)
			stu[i].total[1]=4000;

		if(stu[i].ave>90)
			stu[i].total[2]=2000;
		if(stu[i].ave>85&&stu[i].xi=='Y')
                        stu[i].total[3]=1000;
		if(stu[i].ping>80&&stu[i].gan=='Y')
		        stu[i].total[4]=850;
	}
    for(i=0;i<num;i++)
	{
		for(j=0;j<5;j++)
		{
			stu[i].all+=stu[i].total[j];  //????????????.
		}
	}

	int max=0;
	for(i=0;i<num;i++)
	{
		if(stu[i].all>max)
		{
			max=stu[i].all;//????????,????????
		    j=i;
		}
	}
	int whole=0;
	for(i=0;i<num;i++)
	{
		whole+=stu[i].all;
	}
	printf("%s\n%d\n%d",stu[j].nam,max,whole);

	return 0;
}


struct student
{
	char Name[20];
	int agrades;
	int bgrades;
	char a;
	char b;
	int n;
};
int main(int argc, char* argv[])
{
	struct student *p;
	int i,j,num;
	scanf("%d",&num);
    p=(struct student*)malloc(num*sizeof(struct student));
	for(i=0;i<num;i++)
	{

		scanf("%s%d%d %c %c%d",p[i].Name,&p[i].agrades,&p[i].bgrades,&p[i].a,&p[i].b,&p[i].n);
		//printf("%s %d %d %c %c %d",p[i].Name,p[i].agrades,p[i].bgrades,p[i].a,p[i].b,p[i].n);
	}
	int *p1,*p2;
	p1=(int*)malloc(num*sizeof(int));
	p2=(int*)malloc(num*sizeof(int));
	for(i=0;i<num;i++)
	{
		p1[i]=0;
		p2[i]=0;
		if(p[i].agrades>80&&p[i].n>=1)
		{
			p1[i]++;
			p2[i]+=8000;
		}
		if(p[i].agrades>85&&p[i].bgrades>80)
		{
			p1[i]++;
			p2[i]+=4000;
		}
		if(p[i].agrades>90)
		{
			p1[i]++;
			p2[i]+=2000;
		}
		if(p[i].agrades>85&&p[i].b=='Y')
		{
			p1[i]++;
			p2[i]+=1000;
		}
		if(p[i].bgrades>80&&p[i].a=='Y')
		{
			p1[i]++;
			p2[i]+=850;
		}
	}
    int sum=0;
	for(i=0;i<num;i++)
	{
        sum+=p2[i];
	}
	int max;
	max=p2[0];
	for(i=0;i<num;i++)
	{
		if(max<p2[i])
			max=p2[i];
	}
	for(i=0;i<num;i++)
	{
		if(max==p2[i])
			break;
	}
	printf("%s\n",p[i].Name);
	printf("%d\n",p2[i]);
	printf("%d",sum);

	return 0;
}


int main()
{
	struct stu
	{
		char name[21];
		int qm;
		int cm;
		char xs[21];
		char west[21];
		int paper;
		int sp;
	};
	struct stu a[101];
	int i,n;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",&a[i].name);
		scanf("%d",&a[i].qm);
		scanf("%d",&a[i].cm);
		scanf("%s",&a[i].xs);
		scanf("%s",&a[i].west);
		scanf("%d",&a[i].paper);
		a[i].sp=0;
		if ((a[i].qm>80)&&(a[i].paper>0)) a[i].sp+=8000;
		if ((a[i].qm>85)&&(a[i].cm>80)) a[i].sp+=4000;
		if (a[i].qm>90) a[i].sp+=2000;
		if ((a[i].qm>85)&&(a[i].west[0]=='Y')) a[i].sp+=1000;
		if ((a[i].cm>80)&&(a[i].xs[0]=='Y')) a[i].sp+=850;
	}
	int max,total;
	max=0;
	total=0;
	for (i=0;i<n;i++)
	{
		if (a[i].sp>a[max].sp) max=i;
		total=total+a[i].sp;
	}
	printf("%s\n",a[max].name);
	printf("%d\n",a[max].sp);
	printf("%d\n",total);
	return 0;
}


void main()
{struct xuesheng
{char x[21];
 int qimo;
 int banji;
 char ganbu;
 char xibu;
 int lunwen;
 int qian;
};
 struct xuesheng x[101],*p;
 int i,n,max=0,total=0,money;
 char name[21];
 scanf("%d",&n);
 for (i=0;i<n;i++)
 {scanf("%s %d %d %c %c %d\n",&x[i].x,&x[i].qimo,&x[i].banji,&x[i].ganbu,&x[i].xibu,&x[i].lunwen);
  x[i].qian=0;
  if (x[i].qimo>80&&x[i].lunwen!=0)
	  x[i].qian+=8000;
  if (x[i].qimo>85&&x[i].banji>80)
	  x[i].qian+=4000;
  if (x[i].qimo>90)
	  x[i].qian+=2000;
  if (x[i].qimo>85&&x[i].xibu=='Y')
	  x[i].qian+=1000;
  if (x[i].banji>80&&x[i].ganbu=='Y')
	  x[i].qian+=850;
  total=total+x[i].qian;
 }

 for (i=0;i<n;i++)
	 if(max<x[i].qian)
	 {strcpy(name,x[i].x);max=x[i].qian;}
 printf("%s\n%d\n%d",name,max,total);
}


int main()
{
struct stu
{
	char name[20];
	int qimo;
	int banping;
	char gb[2];
	char xb[2];
	int lw;
	long int jxj;
}stu[100];

	int n,N,a=0,b=0,c=0,d=0,e=0,max,temp,totle=0;
	scanf("%d",&N);
	for(n=0;n<N;n++)
		scanf("%s%d%d%s%s%d",&stu[n].name,&stu[n].qimo,&stu[n].banping,&stu[n].gb,&stu[n].xb,&stu[n].lw);
	for(n=0;n<N;n++)
	{
		a=0;b=0;c=0;d=0;e=0;
		if((stu[n].qimo>80)&&(stu[n].lw>=1))a=8000;
		if((stu[n].qimo>85)&&(stu[n].banping>80))b=4000;
		if(stu[n].qimo>90)c=2000;
		if((stu[n].banping>80)&&(strcmp(stu[n].gb,"Y")==0))e=850;
		if((stu[n].qimo>85)&&(strcmp("Y",stu[n].xb)==0))d=1000;
		stu[n].jxj=a+b+c+d+e;
	}
		for(n=0;n<N;n++)
		{
			totle+=stu[n].jxj;
		}
		for(n=1;n<N;n++)
			if(stu[n].jxj>stu[0].jxj)
			{
				temp=stu[0].jxj;
				stu[0].jxj=stu[n].jxj;
				stu[n].jxj=temp;
				strcpy(stu[0].name,stu[n].name);
			}

	printf("%s\n%d\n%d\n",stu[0].name,stu[0].jxj,totle);
	return 0;
}


struct student
{
    char name[20];
	int aver;
	int judge;
	char a;
	char b;
	int punish;
	int prize;
	struct student *next;
};

int stu_num;

struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int n;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->judge,&p1->a,&p1->b,&p1->punish);
	head=NULL;
	n=0;
	while(n<stu_num-1)
	{
		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->judge,&p1->a,&p1->b,&p1->punish);
	}
	p2->next=p1;
	p1->next=NULL;
	return(head);
}

void main()
{
	struct student *head,*q1,*q2;
	int sum=0;
	scanf("%d",&stu_num);
    head=creat();
	q1=head;
    q2=head;
	while(q1!=NULL)
	{
		q1->prize=0;
		if(q1->aver>80&&q1->punish>0)
			q1->prize+=8000;
		if(q1->aver>85&&q1->judge>80)
			q1->prize+=4000;
		if(q1->aver>90)
            q1->prize+=2000;
		if(q1->aver>85&&q1->b=='Y')
            q1->prize+=1000;
		if(q1->judge>80&&q1->a=='Y')
            q1->prize+=850;
		sum+=q1->prize;
		if(q2->prize<q1->prize)
			q2=q1;
		q1=q1->next;
	}
	printf("%s\n%d\n%d\n",q2->name,q2->prize,sum);
}


void main()
{
	int max,n,i,g=0,sum,qimo,banji,lunwen,zong[200];
	char name[200][20],ganbu,xibu;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",name[i],&qimo,&banji,&ganbu,&xibu,&lunwen);
		zong[i]=0;
		if(qimo>80&&lunwen>=1)
				zong[i]=zong[i]+8000;
			if(banji>80&&qimo>85)
				zong[i]=zong[i]+4000;
				if(qimo>90)
				zong[i]=zong[i]+2000;
					if(qimo>85&&xibu=='Y')
				zong[i]=zong[i]+1000;
						if(banji>80&&ganbu=='Y')
				zong[i]=zong[i]+850;
	}

max=zong[0];
sum=zong[0];
for(i=1;i<n;i++)
{
if(zong[i]>max)
{
max=zong[i];
g=i;
}
	sum=sum+zong[i];
}
for(i=0;i<strlen(name[g]);i++)
	printf("%c",name[g][i]);
printf("\n%d\n%d",zong[g],sum);
}


int main(){
    struct scholar {
           char z[21];
           int qm;
           int bj;
           char gb;
           char xb;
           int paper;
           int total;
           };

           struct scholar a[1000];

    int n, i;
    scanf("%d", &n);

    for (i=0; i<n; i++){
        scanf("%s %d %d %c %c %d", a[i].z, &a[i].qm, &a[i].bj, &a[i].gb, &a[i].xb, &a[i].paper);
        a[i].total=0;
        }

    for (i=0; i<n; i++){
        if (a[i].qm>80&&a[i].paper>0)
        a[i].total+=8000;
        if (a[i].qm>85&&a[i].bj>80)
        a[i].total+=4000;
        if (a[i].qm>90)
        a[i].total+=2000;
        if (a[i].qm>85&&a[i].xb=='Y')
        a[i].total+=1000;
        if (a[i].bj>80&&a[i].gb=='Y')
        a[i].total+=850;
        }

        int max=0;
        char name[22];
        int total=0;

    for (i=0; i<n; i++){
        if (a[i].total>max){
                            max=a[i].total;
                            strcpy(name, a[i].z);
                            }
        total+=a[i].total;
        }

    printf("%s\n%d\n%d\n", name, max, total);

    return 0;

    }


struct student
{
	char name[25];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int lunwen;
	int jiangjin;

};
void main()
{
	int n,q=0;
	struct student stu[100];
	int i,j,k,r,m=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
//		scanf("%d",&stu[i].qimo);
//		scanf("%d",&stu[i].banji);
//		scanf("&c",&stu[i].ganbu);
//		scanf("%c",&stu[i].xibu);
//		scanf("%d",&stu[i].lunwen);
		stu[i].jiangjin=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].lunwen>=1)stu[i].jiangjin=stu[i].jiangjin+8000;
		if(stu[i].qimo>85&&stu[i].banji>80)stu[i].jiangjin=stu[i].jiangjin+4000;
		if(stu[i].qimo>90)stu[i].jiangjin=stu[i].jiangjin+2000;
		if(stu[i].qimo>85&&stu[i].xibu=='Y')stu[i].jiangjin=stu[i].jiangjin+1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')stu[i].jiangjin=stu[i].jiangjin+850;
		q=q+stu[i].jiangjin;
	}
	for(i=0,q=0;i<n;i++)
	{
		if(stu[i].jiangjin>m)m=stu[i].jiangjin;
		q=q+stu[i].jiangjin;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].jiangjin==m)
		{
			printf("%s\n",stu[i].name);
			printf("%d\n",m);
			printf("%d",q);
			break;

		}

	}

}


struct stu
{
	char nam[40];
	int qi;
	int pi;
	char gan;
	char xi;
	int lun;
	int ji;
}stu[102];
void main()
{
	int total=0;
	int i,n,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].nam,&stu[i].qi,&stu[i].pi,&stu[i].gan,&stu[i].xi,&stu[i].lun);
	}
	for(i=0;i<n;i++)
	{
		stu[i].ji=0;
		if(stu[i].qi>80&&stu[i].lun>0)
            stu[i].ji+=8000;
		if(stu[i].qi>85&&stu[i].pi>80)
			stu[i].ji+=4000;
		if(stu[i].qi>90)
			stu[i].ji+=2000;
		if(stu[i].qi>85&&stu[i].xi=='Y')
			stu[i].ji+=1000;
		if(stu[i].pi>80&&stu[i].gan=='Y')
			stu[i].ji+=850;
	}
	for(i=0;i<n;i++)
	{
		total+=stu[i].ji;
	}
	for(i=1;i<n;i++)
	{
		if(stu[i].ji>stu[k].ji)
			stu[k]=stu[i];
	}
	printf("%s\n",stu[k].nam);
	printf("%d\n",stu[k].ji);
	printf("%d\n",total);
}


struct stu
{
	char name[25];
	int score;
	int clas;
	char job;
	char west;
	int paper;
	int sum;
	struct stu*next;
};

void main()
{
	int n,m=0,max=0,all=0;
	char c[25]={'\0'};
	scanf("%d",&n);
	struct stu*p1,*p2,*head;
	struct stu*p;

	p1=(struct stu*)malloc(LEN);
	scanf("%s%d%d %c %c %d",p1->name,&p1->score,&p1->clas,&p1->job,&p1->west,&p1->paper);
	p1->sum=0;
	head=NULL;

	while(n)
	{
		m+=1;
		if(m==1)
			head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct stu*)malloc(LEN);
		scanf("%s%d%d %c %c %d",p1->name,&p1->score,&p1->clas,&p1->job,&p1->west,&p1->paper);
		p1->sum=0;
		n--;
	}
	p2->next=NULL;

	p=head;
	while(p)
	{
		if(p->clas>80)
		{
			if(p->job=='Y')
				p->sum+=850;
			if(p->score>85)
				p->sum+=4000;
		}
		if(p->score>80)
		{
			if(p->paper)
				p->sum+=8000;
			if(p->score>85)
			{
				if(p->west=='Y')
					p->sum+=1000;
			    if(p->score>90)
					p->sum+=2000;
			}
		}
		if(p->sum>max)
		{
			max=p->sum;
			strcpy(c,p->name);
		}
		all+=p->sum;
		p=p->next;
	}
	puts(c);
	printf("%d\n%d",max,all);
}


struct file
{
	char name[50];
	int exam;
	int judge;
	char worker;
	char west;
	int paper;
	int scholarship;
};
int yuanshi(int exam,int paper)
{
	if(exam>80&&paper>=1)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int wusi(int exam,int judge)
{
	if(exam>85&&judge>80)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int chengji(int exam)
{
	if(exam>90)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int xibu(int exam,char west)
{
	if(exam>85&&west=='Y')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int banji(int judge,char worker)
{
	if(judge>80&&worker=='Y')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
void main()
{
	struct file a[110];
	int i,n,sum=0,max=0,orient;
	for(i=1;i<=110;i++)
	{
		a[i-1].scholarship=0;
	}
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",&a[i].name,&a[i].exam,&a[i].judge,&a[i].worker,&a[i].west,&a[i].paper);
		if(yuanshi(a[i].exam,a[i].paper))
		{
			a[i].scholarship+=8000;
		}
		if(wusi(a[i].exam,a[i].judge))
		{
			a[i].scholarship+=4000;
		}
		if(chengji(a[i].exam))
		{
			a[i].scholarship+=2000;
		}
		if(xibu(a[i].exam,a[i].west))
		{
			a[i].scholarship+=1000;
		}
		if(banji(a[i].judge,a[i].worker))
		{
			a[i].scholarship+=850;
		}
		sum+=a[i].scholarship;
	}
	for(i=1;i<=n;i++)
	{
		if(a[i].scholarship>max)
		{
			max=a[i].scholarship;
			orient=i;
		}
	}
	printf("%s\n%d\n%d",a[orient].name,max,sum);
}


struct student
{
	char name[20];
	int final;
	int cla;
	char job;
	char west;
	int essay;
	int bonus;
};

int sco1(struct student a);
int sco2(struct student a);
int sco3(struct student a);
int sco4(struct student a);
int sco5(struct student a);
void bubble(struct student *p,int n);

void main()
{
	int n,i,total=0;
	struct student stu[101]={0,0,0,0,0,0,0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].final,&stu[i].cla,&stu[i].job,&stu[i].west,&stu[i].essay);
		stu[i].bonus=sco1(stu[i])+sco2(stu[i])+sco3(stu[i])+sco4(stu[i])+sco5(stu[i]);
		total=total+stu[i].bonus;
	}
	bubble(stu,n);
	printf("%s\n%d\n%d",stu[0].name,stu[0].bonus,total);
}

int sco1(struct student a)
{
	if(a.final>80&&a.essay>0)
		return 8000;
	else
		return 0;
}
int sco2(struct student a)
{
	if(a.final>85&&a.cla>80)
		return 4000;
	else
		return 0;
}
int sco3(struct student a)
{
	if(a.final>90)
		return 2000;
	else
		return 0;
}
int sco4(struct student a)
{
	if(a.final>85&&a.west=='Y')
		return 1000;
	else
		return 0;
}
int sco5(struct student a)
{
	if(a.cla>80&&a.job=='Y')
		return 850;
	else
		return 0;
}
void bubble(struct student * p,int n)
{
	int i,j;
	struct student t;
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-i-1;j++)
		{
			if(p[j].bonus<p[j+1].bonus)
			{t=p[j];p[j]=p[j+1];p[j+1]=t;}
		}
	}
}


void main()
{
	int n,all=0,i,j,m;
	struct student
	{
		char name[20];
		int score1;
		int score2;
		char monitor;
		char west;
		int paper;
		int money;
	}stu[100];
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,
			&stu[i].score1,&stu[i].score2,&stu[i].monitor,&stu[i].west,
			&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		if(stu[i].score1>80 && stu[i].paper>=1)
			stu[i].money+=8000;
		if(stu[i].score1>85 && stu[i].score2>80)
			stu[i].money+=4000;
		if(stu[i].score1>90)
			stu[i].money+=2000;
		if(stu[i].score1>85 && stu[i].west=='Y')
			stu[i].money+=1000;
		if(stu[i].score2>80 && stu[i].monitor=='Y')
			stu[i].money+=850;
	}
    m=stu[0].money;
	j=0;
	for(i=0;i<n;i++)
	{

			if(stu[i].money>m)
			{
				m=stu[i].money;j=i;
			}

	}
	for(i=0;i<n;i++)
		all+=stu[i].money;
	printf("%s\n%d\n",stu[j].name,stu[j].money);

	printf("%d\n",all);
}


struct student
{
	char name[20];
	int exam;
	int chara;
	char ganbu;
	char west;
	int paper;
};

int scholarship(struct student stu)
{
	int s=0;
	if(stu.exam>80&&stu.paper>0)
		s=s+8000;
	if(stu.exam>85&&stu.chara>80)
		s=s+4000;
	if(stu.exam>90)
		s=s+2000;
	if(stu.exam>85&&(stu.west=='Y'))
		s=s+1000;
	if((stu.ganbu=='Y')&&stu.chara>80)
		s=s+850;
	return(s);

}

void main()
{
	int n,c[100],i,sum=0,max,k;
	struct student stu[100];

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].exam,&stu[i].chara,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
	}

	for(i=0;i<n;i++)
	{
		c[i]=scholarship(stu[i]);
		sum=sum+c[i];
	}

	max=c[0];
	k=0;
	for(i=1;i<n;i++)
	{
		if(c[i]>max)
		{
			max=c[i];
			k=i;
		}
	}

	printf("%s\n",stu[k].name);
	printf("%d\n",c[k]);
	printf("%d\n",sum);

}


struct student
{
	char name[21],a,b;
	int score,c,e,scholar;
};
struct student stu[100],temp;
void main()
{
	int n,i,j,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].score,&stu[i].c,&stu[i].a,&stu[i].b,&stu[i].e);
	}
	/*for(i=0;i<n;i++)
	{
		printf("%s %d %d %c %c %d\n",stu[i].name,stu[i].score,stu[i].c,stu[i].a,stu[i].b,stu[i].e);
	}*/

	for(i=0;i<n;i++)
	{
		stu[i].scholar=0;
		if(stu[i].c>80&&stu[i].a=='Y')
		{
			stu[i].scholar+=850;
		}
		if(stu[i].score>85&&stu[i].b=='Y')
		{
			stu[i].scholar+=1000;
		}
		if(stu[i].score>90)
		{
			stu[i].scholar+=2000;
		}
		if(stu[i].score>85&&stu[i].c>80)
		{
			stu[i].scholar+=4000;
		}
		if(stu[i].score>80&&stu[i].e>=1)
		{
			stu[i].scholar+=8000;
		}
	}
	for(j=1;j<n;j++)
	{
		if(stu[0].scholar<stu[j].scholar)
		{
			temp=stu[0];
			stu[0]=stu[j];
			stu[j]=temp;
		}
	}
	for(j=0;j<n;j++)
		k+=stu[j].scholar;
	printf("\n%s\n%d\n%d",stu[0].name,stu[0].scholar,k);
}


 struct student
  {
   char name[20];
   int mark[2];
   char leader;
   char west;
   int paper;
   int money;
  }stu[100];
void main()
{
  int n,i,j,max,sum=0;
  scanf("%d",&n);
  for (i=0;i<n;i++)
     {scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].mark[0],&stu[i].mark[1],
                               &stu[i].leader,&stu[i].west,&stu[i].paper);
      stu[i].money=0;
      if (stu[i].mark[0]>80 && stu[i].paper>=1) stu[i].money+=8000;
      if (stu[i].mark[0]>85 && stu[i].mark[1]>80) stu[i].money+=4000;
      if (stu[i].mark[0]>90) stu[i].money+=2000;
      if (stu[i].mark[0]>85 && stu[i].west=='Y') stu[i].money+=1000;
      if (stu[i].mark[1]>80 && stu[i].leader=='Y') stu[i].money+=850;
      sum+=stu[i].money;
       }
    max=stu[0].money;
  for (i=1;i<n;i++)
      {
       if (stu[i].money>max) {max=stu[i].money;j=i;}
       }
  printf("%s\n%d\n",stu[j].name,stu[j].money);
  printf("%d",sum);
}