Average scores | 프로그래밍의 벗 PivotOJ
PivotOJ

Average scores

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2017-18 openBOJ 29965

문제

Mari and Jüri are playing a computer game and arguing whose average score is higher. Write a program that based on their results decides whose average score is higher.

입력

The first line of input contains an integer NN (1N5000001 \le N \le 500\,000). Each of the following NN lines contains a capital letter M or J and (separated by a space) an integer PP (0P100000 \le P \le 10\,000), where M stands for Mari and J for Jüri and PP is the number of points achieved during one playthrough by the corresponding player.

출력

The only line of output should consist of capital letter M if Mari's average score is higher than Jüri's, capital letter J if Jüri's average score is higher, or capital letter V if Mari's and Jüri's scores are equal. If a player has not played the game at all, then let that player's average score be 00.

예제

예제 1

입력
5
M 6000
J 7000
M 9545
M 4500
J 3200
출력
M
코드를 제출하려면 로그인하세요.