BRHPHYS - Physics Grade

Butch is afraid that he didn't do so well on his last Physics test. (Isn't it good enough that a bulldog can add and subtract numbers? Why does Mrs. Parker ask him to add and subtract vectors as well?)

He would like to know what letter grade he has right now, but he is too depressed about the test to do it himself.

Given N (0 < N ≤ 10) grades, each with a possible amount of points, Pi (0 ≤ Pi ≤ 200) and a score Si (0 ≤ Si ≤ Pi), find out what grade he would have if Ms. Parker truncates. The grading scale is as follows:

90 - 100 = A
80 - 89 = B
70 - 79 = C
60 - 69 = D
0 - 59 = F (Heaven forbid!)

(Note that the total points will always be more than 0)

Input

Line 1: A single integer, N
Lines 2..N+1: Two space separated integers, Pi and Si

Output

Line 1: A single upper-case character representing the grade he got.

Example

Input:
3
100 89
75 75
100 72

Output: B

Added by:Damon Doucet
Date:2009-12-05
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET

hide comments
2013-10-20 16:09:12 Avinash Sonawane
Why the result on SPOJ is a floating point number and NOT something like "time limit exceeded", "accepted", "wrong answer" etc. ?
What I am supposed to understand from these floating point numbers ?
2011-10-27 00:30:02 Rajkiran Rajkumar
Shouldn't the output be :
B
A
C
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.