Problem:
Grading Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1. The final performance of a student is evaluated by the following procedure:  If the student does not take the midterm or final examination, the student's grade shall be F.  If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A.  If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B.  If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C.  If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C.  If the total score of the midterm and final examination is less than 30, the student's grade shall be F.  Input The input consists of multiple datasets. For each dataset, three integers m , f and r are given in a line. The input ends with three -1 for m , f and r respectively. Your program should not process for the terminal symbols. The number of datasets (the number of students) does not exceed 50. Output For each dataset, print the grade ( A , B , C , D or F ) in a line. Sample Input 40 42 -1
20 30 -1
0 2 -1
-1 -1 -1 Sample Output A
C
F

Solution (Python):
data = raw_input()
while data.count('-1') < 3:
	m,f,r = map(int,data.split(" "))
	if m+f < 30 or m == -1 or f == -1:
		print 'F'
	elif m+f >=80:
		print 'A'
	elif m+f >= 65:
		print 'B'
	elif m+f >= 50 or (m+f >=30 and r>= 50):
		print 'C'
	elif m+f >= 30:
		print 'D'
	elif m+f <30:
		print 'F'
	data = raw_input()

Solution (Python):
test = []
while True:
    tmp = map(int,raw_input().split())
    if tmp[0]==tmp[1]==tmp[2]==-1:
        break
    else:
        test.append(tmp)
for a in test:
    if a[0] == -1 or a[1] == -1:
        print "F"
    elif a[0]+a[1] >= 80:
        print "A"
    elif 80 > a[0]+a[1] >= 65:
        print "B"
    elif 65 > a[0]+a[1] >= 50:
        print "C"
    elif 50 > a[0]+a[1] >= 30:
        if a[2] >= 50 and 50 > a[0]+a[1] >= 30:
            print "C"
        else:
            print "D"
    elif a[0] + a[1] < 30:
        print "F"

Solution (Python):
JUDGE_LIST=[[80, "A"],
            [65, "B"],
            [50, "C"],
            [30, "D"]]

while True:
    try:
        score=[int(x) for x in raw_input().split(" ")]
    except EOFError:
        break
    
    if score[0]==-1 and score[1]==-1 and score[2]==-1:
        break
    
    if score[0]==-1 or score[1]==-1:
        print "F"
        continue

    for judge in JUDGE_LIST:
        if judge[0] <= score[0] + score[1]:
            if "D" == judge[1] and score[2] >= 50:
                print "C"
                break
            else:
                print judge[1]
                break
    else:
        print "F"

Solution (Python):
import sys

for line in sys.stdin:
    m, f, r = map(int, line.split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif (m + f) >= 80:
        print('A')
    elif (m + f) >= 65:
        print('B')
    elif (m + f) >= 50:
        print('C')
    elif (m + f) >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
import sys
 
for line in sys.stdin:
    m, f, r = map(int, line.split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif (m + f) >= 80:
        print('A')
    elif (m + f) >= 65:
        print('B')
    elif (m + f) >= 50:
        print('C')
    elif (m + f) >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Solution (Python):
result = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    sum = m + f

    if m == f == r == -1:
        break

    if m == -1 or f == -1:
        result.append('F')
    elif sum >= 80:
        result.append('A')
    elif sum >= 65:
        result.append('B')
    elif sum >= 50:
        result.append('C')
    elif sum >= 30:
        if r >= 50:
            result.append('C')
        else:
            result.append('D')
    else:
        result.append('F')
    

[print(result[i]) for i in range(len(result))]

Solution (Python):
score = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    score.append([m, f, r])

for mc, fc, rc in score:
    if mc == -1 or fc == -1:
        print('F')
    elif mc + fc >= 80:
        print('A')
    elif mc + fc >= 65:
        print('B')
    elif mc + fc >= 50 or rc >= 50:
        print('C')
    elif mc + fc >= 30:
        print('D')
    else:
        print('F')

Solution (Python):
while True:
    m, f, r = map(int, raw_input().split())
    if m != -1 or f != -1 or r != -1:
        if(m == -1 or f == -1):
            print 'F'
        elif(m + f >= 80):
            print 'A'
        elif(m + f >= 65 and m + f < 80):
            print 'B'
        elif(m + f >= 50 and m + f < 65):
            print 'C'
        elif(m + f >= 30 and m + f < 50):
            if(r >= 50):
                print 'C'
            else:
                print 'D'
        elif(m + f < 30):
            print 'F'
    if m == -1 and f == -1 and r == -1:
        break

Solution (Python):
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if m==-1 or f==-1 :
   print('F')

 elif (m+f)>=80 :
   print('A')

 elif 65<= (m+f) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')

Solution (Python):
import sys
while True:
    (m, f, r) = [int(i) for i in sys.stdin.readline().split()]
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    mf = m + f
    if m == -1 or f == -1 or mf < 30:
        print('F')
    elif mf < 50 and r < 50:
        print('D')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    mf = m + f
    if m == -1 or f == -1 or mf < 30:
        print('F')
    elif mf < 50 and r < 50:
        print('D')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    mf = m + f
    if m == -1 or f == -1 or mf < 30:
        print('F')
    elif mf < 50 and r < 50:
        print('D')
    elif mf < 65:
        print('C')
    elif mf < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    mf = m + f

    if m == -1 or f == -1 or mf < 30:
        print('F')

    elif mf < 50 and r < 50:
        print('D')

    elif mf < 65:
        print('C')

    elif mf < 80:
        print('B')

    elif mf >= 80:
        print('A')

Solution (Python):
while True:
    try:
        m,f,r = map(int,raw_input().split())
        if all(k == -1 for k in [m,f,r]):
            break
    except EOFError:
        break
    
    if m == -1 or f == -1:
        print 'F'
    elif m + f >= 80:
        print 'A'
    elif 65 <= m + f <80:
        print 'B'
    elif 50 <= m + f < 65:
        print 'C'
    elif 30 <= m + f < 50:
        if r >= 50:
            print 'C'
        else:
            print 'D'
    elif m + f < 30:
        print 'F'

Solution (Python):
def grading(m, f, r):
    p = m + f
    if m == -1 or f == -1: return 'F'
    if p >= 80: return 'A'
    if p >= 65: return 'B'
    if (p >= 50) or (r >= 50): return 'C'
    if p >= 30: return 'D'
    return 'F'

if __name__ == '__main__':
    while True:
        m, f, r = [int(i) for i in input().split()]
        if m == f == r == -1: break
        print(grading(m, f, r))

Solution (Python):


while True:
    m,f,r = map(int,input().split())
    if m == f == r == -1:
        break
    elif m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')

Solution (Python):
while True:
	data=list(map(int,input().split()))
	if data[0]==data[1]==data[2]==-1: break
	
	if data[0]!=-1 and data[1]!=-1:
		sum=data[0]+data[1]
	if data[2]!=-1 and sum<data[2]:
		if data[2]>=50:
			sum=50
		
	if data[0]==-1 or data[1]==-1:
		print('F')
	elif sum<30 :
		print('F')
	elif 30<=sum<50:
		print('D')
	elif 50<=sum<65:
		print('C')
	elif 65<=sum<=79:
		print('B')
	elif 80<=sum:
		print('A')

Solution (Python):
import sys

while True:
	m, f, r = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if -1 == m and -1 == f and -1 == r:
		break
	
	mf = ( m + f )
	if -1 == m or -1 == f:
		print( "F" )
	elif 80 <= mf:
		print( "A" )
	elif 65 <= mf and mf < 80:
		print( "B" )
	elif 50 <= mf and mf < 65:
		print( "C" )
	elif 30 <= mf and mf < 50:
		if 50 <= r:
			print( "C" )
		else:
			print( "D" )
	else:
		print( "F" )

Solution (Python):
import sys

while True:
	m, f, r = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if -1 == m and -1 == f and -1 == r:
		break
	
	mf = ( m + f )
	if -1 == m or -1 == f:
		print( "F" )
	elif 80 <= mf:
		print( "A" )
	elif 65 <= mf and mf < 80:
		print( "B" )
	elif 50 <= mf and mf < 65:
		print( "C" )
	elif 30 <= mf and mf < 50:
		if 50 <= r:
			print( "C" )
		else:
			print( "D" )
	else:
		print( "F" )

Solution (Python):
while True:
    m, f, r = map(int, (input().split()))
    score = m + f
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif score >= 80:
            print("A")
        elif 80 > score >= 65:
            print("B")
        elif 65 > score >= 50:
            print("C")
        elif 50 > score >= 30 and r >= 50:
            print("C")
        elif 50 > score >= 30 and r < 50:
            print("D")
        else:
            print("F")

Solution (Python):
while True:
    m, t, f = map( int, raw_input().split())
    if m == -1 and t == -1 and f == -1:
        break
    if m == -1 or t == -1:
        r = "F"
    elif (m + t) >= 80:
        r = "A"
    elif (m + t) >= 65:
        r = "B"
    elif (m + t) >= 50:
        r = "C"
    elif (m + t) >= 30:
        if f >= 50:
            r = "C"
        else:
            r = "D"
    else:
        r = "F"

    print r

Solution (Python):


def main():
    while True:
        line = raw_input()
        if line == '-1 -1 -1':
            break
        middle, final, re = map(int, line.split())
        if middle == -1 or final == -1:
            grade = 'F'
        elif middle + final >= 80:
            grade = 'A'
        elif 65 <= middle + final < 80:
            grade = 'B'
        elif 50 <= middle + final < 65:
            grade = 'C'
        elif 30 <= middle + final < 50:
            if 50 <= re:
                grade = 'C'
            else:
                grade = 'D'
        elif middle + final < 30:
            grade = 'F'
        print grade

if __name__ == '__main__':
    main()

Solution (Python):
while 1:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65 or 30 <= m + f < 50 <= r:
        print('C')
    elif 30 <= m + f < 50:
        print('D')
    else:
        print('F')

Solution (Python):
while 1:
	(a,b,c) = map(int,raw_input().split())
	if a == -1 and b == -1 and c == -1:
		break
	if a == -1 or b == -1:
		print 'F'
	elif a+b >= 80:
		print 'A'
	elif a+b >= 65:
		print 'B'
	elif a+b >= 50:
		print 'C'
	elif a+b >= 30:
		if c >= 50:
			print 'C'
		else:
			print 'D'
	else:
		print 'F'

Solution (Python):
while True:

    (m, f, r) = [int(i) for i in input().split()]

    if m == f == r == -1 :
        break

    sum = m + f

    if m == -1 or f == -1 or sum < 30 :
        print('F')
    elif sum < 50 and r < 50 :
        print('D')
    elif sum < 65 :
        print('C')
    elif sum < 80 :
        print('B')
    else :
        print('A')

Solution (Python):
score = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    score.append([m, f, r])
 
for mc, fc, rc in score:
    if mc == -1 or fc == -1:
        print('F')
    elif mc + fc >= 80:
        print('A')
    elif mc + fc >= 65:
        print('B')
    elif mc + fc >= 50 or rc >= 50:
        print('C')
    elif mc + fc >= 30:
        print('D')
    else:
        print('F')

Solution (Python):
while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1: break

    if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    s = m + f

    if m == -1 or f == -1 or s < 30:
        print('F')
    elif s < 50 and r < 50:
        print('D')
    elif s < 65:
        print('C')
    elif s < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1: 
        break

    total = m + f 
    if m == -1 or f == -1 or total < 30: 
        print('F')
    elif total < 50 and r < 50: 
        print('D')
    elif total < 65: 
        print('C')
    elif total < 80: 
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    s = m + f
 
    if m == -1 or f == -1 or s < 30:
        print('F')
    elif s < 50 and r < 50:
        print('D')
    elif s < 65:
        print('C')
    elif s < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    ( m, f, r) = [ int(i) for i in input().split()]
    if ( m == f == r == -1): break

    total = m + f
    achieve = ''
    if m == -1 or f == -1 or total < 30: achieve = 'F'
    elif total < 50 and r < 50: achieve = 'D'
    elif total < 65: achieve = 'C'
    elif total < 80: achieve = 'B'
    else: achieve = 'A'

    print(achieve)

Solution (Python):
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
  
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
mf = 0
while True:
    m,f,r = [int(i) for i in input().strip().split()]
    if m==f==r==-1 : break
    mf = m+f

    if m*f<0 or mf<30 : print("F")
    elif mf<50 and r<50 : print("D")
    elif mf<65 : print("C")
    elif mf<80 : print("B")
    elif mf>=80 : print("A")
    else: print("F")

Solution (Python):
def getGrade(m, f, r):
  grade = ""
  if m == -1 or f == -1:
    grade = "F"
  elif m + f >= 80:
    grade = "A"
  elif m + f >= 65:
    grade = "B"
  elif m + f >= 50:
    grade = "C"
  elif m + f >= 30:
    if r >= 50:
      grade = "C"
    else:
      grade = "D"
  else:
    grade = "F"
  return grade

while True:
  line = raw_input().split(" ")
  m = int(line[0])
  f = int(line[1])
  r = int(line[2])
  if m == -1 and f == -1 and r == -1:
    break
  else:
    print getGrade(m, f, r)

Solution (Python):
while 1:
    m,f,r=map(int, raw_input().split())
    if m==f==r==-1: break
    s=m+f
    if m==-1 or f==-1 or s<30: R="F"
    elif s>=80: R="A"
    elif s>=65: R="B"
    elif s>=50: R="C"
    elif r>=50: R="C"
    else: R="D"
    print R

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1: break
    if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
	m,f,r=map(int,raw_input().split())
	if m==f==r==-1: break
	if m+f<30 or m==-1 or f==-1: print 'F'
	elif m+f>=80: print 'A'
	elif 65<=m+f: print 'B'
	elif 50<=m+f: print 'C'
	elif r>=50: print 'C'
	else: print 'D'

Solution (Python):
midExam, finalExam, reExam = list(map(int, input().split()))
addedResult = midExam + finalExam

while True :
    if midExam == -1 and finalExam == -1 and reExam == -1 :
        break;
    
    if midExam == -1 or finalExam == -1 or addedResult < 30 :
        print("F")
    elif addedResult >= 80 :
        print("A")
    elif addedResult >= 65 and addedResult < 80 :
        print("B")
    elif addedResult >= 50 and addedResult < 65 :
        print("C")
    elif addedResult >= 30 and addedResult < 50 :
        if reExam >= 50 :
            print("C")
        else :
            print("D")
    midExam, finalExam, reExam = list(map(int, input().split()))
    addedResult = midExam + finalExam

Solution (Python):
a = []
while True:
    b = map(int, raw_input().split())
    if b == [-1, -1, -1]:
        break
    a.append(b)
for list in a:
    m, f, r = list
    if m == -1 or f == -1:
        print 'F'
    elif m + f >= 80:
        print 'A'
    elif m + f >= 65:
        print 'B'
    elif m + f >= 50:
        print 'C'
    elif m + f >= 30:
        if r >= 50:
            print 'C'
        else:
            print 'D'
    else:
        print 'F'

Solution (Python):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Solution (Python):
while True:
    m, f, r = map(int, raw_input().split())

    if (m+f+r) == -3:
        break

    if (m * f) < 0:
        print "F"
    elif (m + f) >= 80:
        print 'A'
    elif 65 <= (m + f) < 80:
        print 'B'
    elif 50 <= (m + f) < 65:
        print 'C'
    elif 30 <= (m + f) < 50:
        if r < 50:
            print 'D'
        else:
            print 'C'
    elif (m + f) < 30:
        print 'F'

Solution (Python):
mf = 0
while True:
    m,f,r = [int(i) for i in input().strip().split()]
    if m==f==r==-1 : break
    mf = m+f
 
    if m*f<0 or mf<30 : print("F")
    elif mf<50 and r<50 : print("D")
    elif mf<65 : print("C")
    elif mf<80 : print("B")
    elif mf>=80 : print("A")
    else: print("F")

Solution (Python):
import sys

for i in sys.stdin:
    scores = list(map(int, i.split()))
    m = scores[0]
    f = scores[1]
    r = scores[2]
    if m == f == r == -1:
        break
    elif (m == -1) or (f == -1):
        print("F")
    elif m + f >= 80:
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True :
	m,f,r=map(int,raw_input().split())
	if m==-1 and f==-1 and r==-1:
		break
	else:
		if m==-1 or f==-1 :
			print 'F'
		elif m+f >= 80:
				print 'A'
		elif m+f >= 65:
			print 'B'
		elif m+f >= 50 or r>=50:
			print 'C'
		elif m+f >= 30:
			print 'D'
		else :
			print'F'

Solution (Python):
L=[]
c=0
while 1:
  L+=[map(int, raw_input().split())]
  if L[c][0]+L[c][1]+L[c][2]==-3:
    break
  c+=1
  
c=0
while 1:
  if L[c][0]+L[c][1]+L[c][2]==-3:
    break
  if L[c][0]==-1 or L[c][1]==-1 or L[c][0] + L[c][1] < 30:
    print 'F'
  elif L[c][0] + L[c][1] >=80:
    print 'A'
  elif 65 <= L[c][0] + L[c][1] < 80:
    print 'B'
  elif 50 <= L[c][0] + L[c][1] < 65 or 30 <= L[c][0] + L[c][1] < 50 and L[c][2] >= 50:
    print 'C'
  else:
    print 'D'
  c+=1

Solution (Python):
while True:
    m,f,r = map(int,raw_input().split())
    if m==-1 and f==-1 and r==-1:
        break 
    mfsum = m+f
    if m==-1 or f==-1:
        print "F"
    elif mfsum >=80:
        print "A"
    elif mfsum >= 65 and mfsum <80:
        print "B"
    elif mfsum >= 50 and mfsum < 65:
        print "C"
    elif mfsum >=30 and mfsum < 50:
        if r >= 50:
            print "C"
        else: 
            print "D"
    else:
        print "F"

Solution (Python):
def code():
	l = []
	while True:
		m,f,r = map(int,input().split())
		if m == f == r == -1:
			break
		else:
			l.append([m,f,r])
	for i in l:
		s = ''
		x = i[0]+i[1]
		if i[0] == -1 or i[1] == -1:
			s = 'F'
		elif x >= 80:
			s = 'A'
		elif x >= 65:
			s = 'B'
		elif x >= 50:
			s = 'C'
		elif x >= 30:
			s = 'D'
			if i[2] >= 50:
				s = 'C'
		else:
			s = 'F'
		print(s)
code()

Solution (Python):
data = []
while True:
    in_line = raw_input().split()
    m = int(in_line[0])
    f = int(in_line[1])
    r = int(in_line[2])
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        data.append("F")
    elif m + f >= 80:
        data.append("A")
    elif m + f >= 65:
        data.append("B")
    elif m + f >= 50:
        data.append("C")
    elif m + f >= 30:
        if r >= 50:
            data.append("C")
        else:
            data.append("D")
    else:
        data.append("F")
for n in data:
    print n

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
        continue
    s = m + f
    if s >= 80:
        print('A')
    elif s >= 65:
        print('B')
    elif s >= 50:
        print('C')
    elif s >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Solution (Python):
while True:
    m, f, r = map(int, raw_input().split(" "))
    if m==f==r==-1:
        break
    if m==-1 or f==-1:
        print("F")
    elif m+f >= 80:
        print("A")
    elif 65 <= m+f < 80:
        print("B")
    elif 50 <= m+f < 65:
        print("C")
    elif 30 <= m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m+f < 30:
        print("F")

Solution (Python):
while True:
    m,f,r=map(int,input().split())
    p=m+f
    if m+f+r==-3:
        break
    if m==-1 or f==-1:
        print("F")
    elif p>=80:
        print("A")
    elif 65<=p and p<80:
        print("B")
    elif 50<=p and p<65:
        print("C")
    elif 30<=p and p<50:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):


scores = []
grades = []
while (1):
    one = list(map(int, input().split()))
    if sum(one) <= -3:
        break
    scores.append(one)

for s in scores:
    
    if (s[0] == -1 or s[1] == -1):
        grades.append('F')
        continue
    
    if (s[0] + s[1] >= 80):
        grades.append('A')
        continue
    
    if (s[0] + s[1] >= 65):
        grades.append('B')
        continue
    
    if (s[0] + s[1] >= 50):
        grades.append('C')
        continue
    
    if (s[0] + s[1] >= 30):
        if (s[2] >= 50):
            grades.append('C')
            continue
        else:
            grades.append('D')
            continue
    grades.append('F')

for g in grades:
    print(g)

Solution (Python):
while True:
    i = input().split()
    m, f, r = map(int, i)

    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif m+f < 80 and m+f >= 65:
        print('B')
    elif m+f < 65 and m+f >= 50:
        print('C')
    elif m+f < 50 and m+f >=30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Solution (Python):
while True:
    m, f, v = [int(n) for n in input().split()]

    if m == f == v == -1:
        break
    sum = m + f
    if m == -1 or f == -1:
        print("F")
    elif 80 <= sum:
        print("A")
    elif 65 <= sum < 80:
        print("B")
    elif 50 <= sum < 65:
        print("C")
    elif 30 <= sum < 50:
        if 50 <= v:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
i = 0
while True:
	m,f,r = list(map(int, input().split()))
	if (m == -1 and f == -1 and r == -1):
		break
	elif ((m == -1) or (f == -1)) or (m + f < 30):
		print("F")
	elif (80 <= m + f):
		print("A")
	elif (65 <= m + f) and (m + f < 80):
		print("B")
	elif (50 <= m + f) and (m + f < 65) or (50 <= r):
		print("C")
	elif (30 <= m + f) and (m + f <50) :
		print("D")

Solution (Python):
while True:
	m,f,r = list(map(int, input().split()))
	if (m == -1 and f == -1 and r == -1):
		break
	elif ((m == -1) or (f == -1)) or (m + f < 30):
		print("F")
	elif (80 <= m + f):
		print("A")
	elif (65 <= m + f) and (m + f < 80):
		print("B")
	elif (50 <= m + f) and (m + f < 65) or (50 <= r):
		print("C")
	elif (30 <= m + f) and (m + f <50) :
		print("D")

Solution (Python):
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'
    s = m + f
    if s >= 80:
        return 'A'
    elif s >= 65:
        return 'B'
    elif s >= 50:
        return 'C'
    elif s < 30:
        return 'F'
    elif r >= 50:
        return 'C'
    else:
        return 'D'


while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    print(grade(m, f, r))

Solution (Python):
num = []
while True:
    m,f,r = map(int, raw_input().split())

    ans = m + f
    if m == f == r == -1:
        break
    if (m == -1) or (f == -1):
        num.append("F")
    elif ans >= 80:
        num.append("A")
    elif (65 <= ans) and (ans < 80):
        num.append("B")
    elif (50 <= ans) and (ans < 65):
        num.append("C")
    elif (30 <= ans) and (ans < 50):
        if r >= 50:
            num.append("C")
        else:
            num.append("D")
    else:
        num.append("F")

for i in range(len(num)):
    print num[i]

Solution (Python):
num = []
while True:
    l = map(int, raw_input().split())
    if l[0] == l[1] == l[2] == -1:
        break
    if l[0]*l[1] < 0:
        num.append("F")
    else:
        sum = l[0] + l[1]
        if sum >= 80:
            num.append("A")
        elif sum >= 65:
            num.append("B")
        elif sum >= 50:
            num.append("C")
        elif sum >= 30:
            if l[2] >= 50:
                num.append("C")
            else:
                num.append("D")
        else:
            num.append("F")

for i in range(len(num)):
    print num[i]