Problem1511--Who took the most Scholarships

1511: Who took the most Scholarships

[Creator : ]
Time Limit : 1 sec  Memory Limit : 128 MB

Description

 

The practice of CDUTCM is to grant scholarships after each semester's final examination. There are five kinds of scholarships, and the conditions are different.

 

1) academician scholarship, 8000 yuan per person, the end of the term average higher than 80 points (>80), and in this semester to publish 1 or more than 1 papers can be obtained;

 

2) 54 scholarship, 4000 yuan per person, average final score higher than 85 points (>85) at the end of the semester, and the students whose class appraisal scores are above 80 points (>80) can be obtained.

 

3) the best performance award is 2000 yuan per person, and the average final score is higher than 90 points (>90).

 

4) scholarship in the west, 1000 yuan per person, and the average student achievement in the western part of the province is higher than 85 points (>85).

 

5) the class contribution award, 850 yuan per person, and the class appraisal score higher than 80 points (>80) can be obtained by student leaders.

 

As long as they meet the requirements, they can be awarded. There are no restrictions on the number of awards per scholarship, and each student can also get many scholarships at the same time. For example, Yao Lin's final average score is 87 points, class review results are 82 points, and he is still a student cadre, then he can win both the 54 scholarship and the class contribution award, the total scholarships is 4850 yuan.

Now give some students' relevant data, please calculate which students get the highest total scholarships(assuming that some students can meet the requirements of scholarship).

Input

The first line of input is an integer N (1 < = N < 100), indicating the total number of students. The next N line is a student's data, from left to right is the name, the end of the term average, class evaluation, whether the student cadre, whether the western province students, and the number of papers published. The name is a string of no more than 20 of the length and write of English letters (without space); the final average and class comments are an integer between 0 and 100 (including 0 and 100); whether the student leader and the western province students are represented in one character respectively, Y is, N is not; published. The number of papers is from 0 to 10 integers (including 0 and 10). Each two adjacent data items are separated by one space.

Output

The output includes three rows, the first line is the name of the student who gets the most scholarships, and the second row is the total number of scholarships awarded by the student. If two or two or more students get the most scholarships, the first student's name will appear in the input document. The third line is the total number of scholarships awarded to the N students.

Sample Input Copy

4
WangYue 87 82 Y N 0
LiChangLin 88 78 N Y 1
ZhangFan 92 88 N N 0
NiuBi 83 87 Y N 1

Sample Output Copy

LiChangLin
9000
28700

HINT

vijos

Source/Category