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):
while True:
    m, f, r = map(int, input().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 or (m+f>=30 and r>=50):
        print("C")
    elif m+f>= 30:
        print("D")

Solution (Python):
while True:
    m, f, r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif 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')

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

Solution (Python):
while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif 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 and r >= 50:
        print("C")
    elif 30 <= m + f and m + f <50:
        print("D")
    else:
        print("F")

Solution (Python):
a = []
i = 0
n = 0
calc = 0

while True:
    a.append(list(map(int, input().split())))
    if a[n][0] == -1 and a[n][1] == -1 and a[n][2] == -1:
        break
    n += 1

while i < n:
    calc = a[i][0] + a[i][1]

    if a[i][0] < 0 or a[i][1] < 0:
        print("F")
    else:
        if calc >= 80:
            print("A")
        elif calc >= 65 and calc < 80:
            print("B")
        elif calc >= 50 and calc < 65:
            print("C")
        elif calc >= 30 and calc < 50:
            if a[i][2] >= 50:
                print("C")
            else:
                print("D")
        elif calc < 30:
            print("F")
    i += 1

Solution (Python):
while True:
    m, f, r = map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif 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')

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

Solution (Python):
import math
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')
    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')
    else:
        print('F')

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")
	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 = map(int, input().split())

    if sum((m, f, r)) == -3: 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 = map(int,input().split())
    if M == -1 and F == -1 and 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 or (M + F >= 30 and R >= 50):
        print('C')
    elif M + F >= 30:
        print('D')
    else:
        print('F')

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

    if m == -1 and f == -1 and 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, input().split())
	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 >= 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:
    a,b,c = map(int,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 = list(map(int, input().split()))
  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 >= 65:
    print("B")
  elif m + f >= 50:
    print("C")
  elif m + f >= 30:
    print("C" if r >= 50 else "D")
  else:
    print("F")

Solution (Python):
while True:
    m, f, r = [int(line) for line in input().split()]
    if m == f == r == -1:
        break
    if -1 in (m, f):
        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 = map(int,input().split())
    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 65<=M+F:
        print("B")
    elif 50<=M+F:
        print("C")
    elif 30<=M+F:
        if R>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True:
    m, f, r = map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif 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')

Solution (Python):
while True:
    m, f, r = list(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 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=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    
    if m==-1 or f==-1 or m+f<30:
        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 and r<50:
        print("D")
    else:
        print("C")

Solution (Python):
a = []
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")
  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=map(int,input().split())
    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>=65:
        print("B")
    elif m+f>=50:
        print("C")
    elif m+f>=30 and r>=50:
        print("C")
    elif m+f>=30:
        print("D")
    elif m+f<30:
        print("F")

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

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')
    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 and r >= 50:
        print('C')
    elif m+f >= 30 and m+f < 50:
        print('D')
    elif m+f <= 30:
        print('F')

Solution (Python):
grades = []
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:
        grades.append('F')
        continue
    if m + f >= 80:
        grades.append('A')
        continue
    if m + f >= 65:
        grades.append('B')
        continue
    if m + f >= 50:
        grades.append('C')
        continue
    if m + f >= 30:
        if r >= 50:
            grades.append('C')
            continue
        else:
            grades.append('D')
            continue
    if m + f < 30:
        grades.append('F')

for grade in grades:
    print(grade)

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

Solution (Python):
def seiseki(list):
    goukei = list[0]+list[1]
    saishiken = list[2]
    if (list[0]==-1) or (list[1]==-1) or (goukei<30):
        return 'F'
    elif (goukei >= 80):
        return 'A'
    elif (goukei >= 65):
        return 'B'
    elif (goukei >= 50) or (saishiken >= 50):
        return 'C'
    else:
        return 'D'

flag = True
a = []

while flag:
    t = list(map(int, input().split()))
    if (t[0] == -1) and (t[1] == -1) and (t[2] == -1):
        flag = False
        continue
    a.append(t)
for i in a:
    str = seiseki(i)
    print(str)

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

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

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

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

    if m + r >= 80:
        grade = "A"
    elif m + r >= 65 and m + r < 80:
        grade = "B"
    elif m + r >= 50 and m + r < 65:
        grade = "C"
    elif m + r >= 30 and m + r < 50:
        grade = "D"
    elif m + r <= 30:
        grade = "F"

    if grade == "D" and f >= 50:
        grade = "C"

    if m == -1 or r == -1:
        grade = "F"

    print(grade)

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

Solution (Python):
while True:
    m, f, r = map(int, 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:
            print('C')
        elif m + f >= 30:
            if r >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')

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

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

    if (m == -1) and (f == -1) and (r == -1):
        break
    goukei = m + f

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

Solution (Python):
while 1:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    
    sc  = m + f
    if m == -1 or f == -1:  print('F')
    elif 79 < sc:           print('A')
    elif 64 < sc:           print('B')
    elif 49 < sc:           print('C')
    elif 29 < sc:
        if 49 < r:          print('C')
        else:               print('D')
    else:                   print('F')

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 < 80:
        print('B')
    elif 50 <= m + f < 65 or r >= 50:
        print('C')
    elif  m + f < 30:
        print('F')
    elif 30 <= m +f < 50 and r < 50:
        print('D')

Solution (Python):
while True:
    m,f,r = map(int, input().split(' '))
    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,input().split())
  if m == -1 and f == -1 and r == -1: exit()

  if m == -1 or  f == -1 or m + f < 30 :  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')

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

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')
    elif m+f >= 80:
        print('A')
    elif 65 <= m+f <=80:
        print('B')
    elif 50 <= m+f < 65 or 30 <= m+f <50 and r >= 50:
        print('C')
    elif 30 <= m+f < 50:
        print('D')
    elif 30 > m+f:
        print('F')

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 m+f>=65:
        print("B")
    elif m+f>=50:
        print("C")
    elif m+f>=30 and r>=50:
        print("C")
    elif m+f>=30:
        print("D")
    else:
        print("F")

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:
        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 and r >= 50:
        print("C")
    elif m+f < 50 and m+f >= 30 and r < 50:
        print("D")
    else:
        print("F")

Solution (Python):
"""
中間試験と期末試験は 50 点満点（m, f ≤ 50）、再試験は 100 点満点 （r ≤ 100）
試験を受けていない場合は点数を -1

中間試験、期末試験のいずれかを欠席した場合成績は F。
中間試験と期末試験の合計点数が 80 以上ならば成績は A 。
中間試験と期末試験の合計点数が 65 以上 80 未満ならば成績は B。
中間試験と期末試験の合計点数が 50 以上 65 未満ならば成績は C。
中間試験と期末試験の合計点数が 30 以上 50 未満ならば成績は D。 ただし、再試験の点数が 50 以上ならば成績は C。
中間試験と期末試験の合計点数が 30 未満ならば成績は F
"""
while True:
    mid_test, fin_test, re_test = map(int, input().split())
    if (mid_test == -1) & (fin_test == -1) & (re_test == -1):
        break
    else:
        if (mid_test == -1) or (fin_test == -1):
            print("F")
        else:
            total_mf = mid_test + fin_test
            if total_mf >= 80:
                print("A")
            elif 65 <= total_mf < 80:
                print("B")
            elif 50 <= total_mf < 65:
                print("C")
            elif 30 <= total_mf < 50:
                if re_test >= 50:
                    print("C")
                else:
                    print("D")
            else:
                print("F")

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

Solution (Python):
grade = []

while 1:
    grade.append(list(map(int, input().split())))
    if grade[-1][0] == -1 and grade[-1][1] == -1 and grade[-1][2]: break

for i in range(len(grade) - 1):
    if grade[i][0] == -1 or grade[i][1] == -1:
        print('F')
    elif grade[i][0] + grade[i][1] >= 80:
        print('A')
    elif grade[i][0] + grade[i][1] >= 65:
        print('B')
    elif grade[i][0] + grade[i][1] >= 50:
        print('C')
    elif grade[i][0] + grade[i][1] >= 30 and grade[i][2] >= 50:
        print('C')
    elif grade[i][0] + grade[i][1] >= 30:
        print('D')
    else:
        print('F')

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

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

Solution (Python):
def Score(m,f,r):
    if m == -1:
        m = 0
        return "F"
    if f == -1:
        f = 0
        return "F"
    if  (m + f ) >=80:
        return "A"
    elif (m + f ) < 80 and (m + f ) >= 65:
        return "B"
    elif (m + f ) < 65 and (m + f ) >= 50:
        return "C"
    elif (m + f ) < 50 and (m + f ) >= 30:
        if r >= 50:
            return "C"
        return "D"
    elif (m + f) < 30:
        return "F"

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

Solution (Python):
EOL = '-1 -1 -1'

def grading(m, f, r):
    score_sum = m + f

    if -1 in [m, f] or score_sum < 30:
        return 'F'
    
    if score_sum >= 80:
        return 'A'
    elif score_sum >= 65:
        return 'B'
    elif score_sum >= 50:
        return 'C'
    
    if r >= 50:
        return 'C'
        
    return 'D'
   


for line in iter(input, EOL):
    m, f, r = map(int, line.split())
    print(grading(m, f, r))

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

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

Solution (Python):
while True:
  m, f, r = map(int, input().split())
  if m == -1 and f == -1 and 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=map(int,input().split())
    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>=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')

Solution (Python):
for _ in range(50):
    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 80 > s >= 65:
        print("B")
    elif 65 > s >= 50:
        print("C")
    elif 50 > s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif 30 > s:
        print("F")

Solution (Python):
while True:
    m, f, r = (int(x) for x in input().split())
    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>= 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")

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')
    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')

Solution (Python):

while True:
    a,b,c=map(int,input().split())
    d = a+b
    
    if a == -1 and b == -1 and c == -1:
        break
    
    if a == -1 or b == -1:
        print("F")
    elif d < 30:
        print("F")
    elif d < 50:
        if c >= 50:
            print("C")
        else:
            print("D")
    elif d < 65:
        print("C")
    elif d < 80:
        print("B")
    else:
        print("A")

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

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")
    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")
    elif m+f < 30:
        print("F")

Solution (Python):
for i in range(50):
    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')
    elif m + f >= 80:
        print('A')
    elif 80 > m + f >= 65:
        print('B')
    elif 65 > m + f >= 50:
        print('C')
    elif 50 > m + f >= 30 and r >= 50:
        print('C')
    elif 50 > m + f >= 30:
        print('D')
    else:
        print('F')

Solution (Python):


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

Solution (Python):
ans = []
for i in range(100000):
  m, f, r = map(int, input().split())
  mf_sum = m + f

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

  if m == -1 and f == -1 and r == -1:
    break
  ans.append(val)

[print(x) for x in ans]

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

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

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    while True:
        m, f, r = map(int, input().split())
        if m==-1 and f==-1 and r==-1:
            sys.exit()
        elif m==-1 or f==-1:
            print("F")
        else:
            if 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")
    
if __name__ == "__main__":
    main()

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

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 m + f >= 65:
        print("B")

    elif m + f >= 50 or m+f+r >= 80:
        print("C")

    elif m+f >= 30:
        print("D")
    else:
        print("F")

Solution (Python):
m,f,r = [],[],[]

while True:
    a,b,c=map(int,input().split())
    if (a==-1) & (b==-1) & (c==-1):
        break
    m.append(a)
    f.append(b)
    r.append(c)

for i in range(len(m)):
    judge = m[i]+f[i]
    if (m[i]<0) or (f[i]<0):
        print('F')
        continue
            
    if (judge >= 80):
        print('A')
    
    elif (judge < 80) & (judge >= 65):
        print('B')
    
    elif (judge < 65) & (judge >= 50):
        print('C')
    
    elif (judge < 50) & (judge >= 30):
        if r[i] >= 50:
            print('C')
        else:
            print('D')
        
    elif judge < 30:
        print('F')