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):
for i in range(50):
  m,f,r=(int(x) for x in input().split())

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

  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):
import sys
while True:
    m, f, r = [int(i) for i in sys.stdin.readline().strip().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,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:
        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())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    else:
        s=m+f
        if s>=80:
            print("A")
        if 65<=s<80:
            print("B")
        if 50<=s<65:
            print("C")
        if 30<=s<50:
            if r>=50:
                print("C")
            else:
                print("D")
        if s<30:
            print("F")

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

Solution (Python):


import math

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:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True:
    mid, fin, ree = map(int, input().split())
    if mid == -1 and fin == -1 and ree == -1:
        break
    if mid == -1 or fin == -1:
        print('F')
        continue
    score = mid + fin
    if   score >= 80:
        print('A')
    elif score >= 65:
        print('B')
    elif score >= 50:
        print('C')
    elif score >= 30:
        if ree >= 50:
            print('C')
        else:
            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):
for i in range(50):
    a,b,c = map(int,input().split())
    d = a+b
    if a == b == c == -1:
        exit()
    elif a == -1 or b == -1 or d < 30:
        print("F")
    elif 80 <= d:
        print("A")
    elif 65 <= d < 80:
        print("B")
    elif 50 <= d < 65 or (30 <= d < 50 and 50 <= c):
        print("C")
    elif 30 <= d < 50:
        print("D")

Solution (Python):



num=[]
while True:
    num.append(list(map(int,input().split(" "))))
    if num[-1]==[-1,-1,-1]:
        num=num[:-1]
        break

def saiten(lst):
    tmp=""
    if lst[0]== -1 or lst[1]== -1:
        tmp="F"
    elif lst[0]+lst[1]>=80:
        tmp="A"
    elif lst[0]+lst[1]>=65:
        tmp="B"
    elif lst[0]+lst[1]>=50:
        tmp="C"
    elif lst[0]+lst[1]>=30:
        if lst[2]>=50:
            tmp="C"
        else:
            tmp="D"
    else:
        tmp="F"
    return tmp
ans=[saiten(i)for i in num]
for i in ans:
    print(i)

Solution (Python):
import sys
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        sys.exit()
    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):
    var=input()
    var=var.split()
    m=int(var[0])
    r=int(var[1])
    f=int(var[2])
    if(m==r==f==-1):
        break
    if(m==-1 or r==-1):
        print("F")
    elif((m+r)>=80):
        print("A")
    elif(65<=(m+r)<80):
        print("B")
    elif(50<=(m+r)<80):
        print("C")
    elif(30<=(m+r)<50 and f<50):
        print("D")
    elif(30<=(m+r)<50 and f>=50):
        print("C")
    elif((m+r)<30):
        print("F")

Solution (Python):
results = []
grades = []

while True:
    result = list(map(int, input().split()))
    if result == [-1, -1, -1]:
        break
    results.append(result)
    


for i in range(len(results)):
    mid = results[i][0]
    ret = results[i][2]
    fin = results[i][1]
    if mid == -1 or fin == -1:
        grades.append("F")
    elif mid + fin >= 80:
        grades.append("A")
    elif mid + fin >= 65 and mid + fin < 80:
        grades.append("B")
    elif mid + fin >= 50 and mid + fin < 65:
        grades.append("C")
    elif mid + fin >= 30 and mid + fin < 50:
        if ret >= 50:
            grades.append("C")
        else:   
            grades.append("D")
    else:
        grades.append("F")
    
for i in range(len(results)):
    print(grades[i])

Solution (Python):


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

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

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

Solution (Python):







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

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):
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==f==r==-1:
        break
    x = m + f
    if m==-1 or f==-1:
        print("F")
    elif x >= 80:
        print("A")
    elif x >= 65 and x < 80:
        print("B")
    elif x >= 50 and x < 65:
        print("C")
    elif x >= 30 and x < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif x < 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 and r>=50:
        print('C')
    elif m+f>=30 and m+f<50 and r<50:
        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:
        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
    elif 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):
m, f, r = map(int, input().split())
while m >= 0 or f >= 0 or r >= 0:
	if m < 0 or f < 0 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:
		if r >= 50:
			print("C")
		else:
			print("D")
	m, f, r = map(int, input().split())

Solution (Python):
XS = list(map(int, open(0).read().split()))
for i in range(0, len(XS), 3):
    m, f, r = XS[i:i+3]
    if m == -1 and f == -1 and r == -1:
        break

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

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

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

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

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

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

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

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

    m, f, r = map(int, input().split())

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1:
            ans = "F"
        elif m + f >= 80:
            ans = "A"
        elif m + f >= 65:
            ans = "B"
        elif m + f >= 50:
            ans = "C"
        elif m + f >= 30:
            if r >= 50:
                ans = "C"
            else:
                ans = "D"
        else:
            ans = "F"
    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')
    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 m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    else:
        s=m+f
        if s>=80:
            print("A")
        if 65<=s<80:
            print("B")
        if 50<=s<65:
            print("C")
        if 30<=s<50:
            if r>=50:
                print("C")
            else:
                print("D")
        if s<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 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):
flg = True
while flg:
    m, f, r = map(int, input().split())
    if m == -1 :
        if f == -1:
            if r == -1:
                flg = False
    if flg:
        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")
        elif m+f < 30:
            print("F")

Solution (Python):
import sys


def is_a(m: int, f: int) -> bool:
    if 80 <= m + f:
        return True
    return False


def is_b(m: int, f: int) -> bool:
    if 65 <= m + f < 80:
        return True
    return False


def is_c(m: int, f: int, r: int) -> bool:
    if 50 <= r:
        return True
    if 50 <= m + f < 65:
        return True
    return False


def is_d(m: int, f: int, r: int) -> bool:
    if 30 <= m + f < 50:
        if 50 <= r:
            return False
        return True
    return False


def rank(m: int, f: int, r: int) -> str:
    if -1 in [m, f]:
        return 'F'

    if m < 0:
        m = 0
    if f < 0:
        f = 0
    if r < 0:
        r = 0

    if is_d(m, f, r):
        return 'D'
    if is_c(m, f, r):
        return 'C'
    if is_b(m, f):
        return 'B'
    if is_a(m, f):
        return 'A'
    return 'F'


def resolve():
    for line in sys.stdin:
        m, f, r = map(int, line.split())

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

        print(rank(m, f, r))


resolve()

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

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

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

    print(s)

Solution (Python):
while True:
    dataset = input().split(" ")
    m = int(dataset[0])
    f = int(dataset[1])
    r = int(dataset[2])

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

    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"

    print(grade)

Solution (Python):
test=[]
while True:
  m,r,f=map(int,input().split(' '))
  if m==-1 and r==-1 and f== -1:
    break
  else:
    test.append([m,r,f])



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

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

Solution (Python):
def main():
    while True:
        mid_score,final_score,makeup_score = map(int,input().split())
        if mid_score==-1 and final_score==-1 and makeup_score==-1:
            exit()
        if mid_score == -1 or final_score==-1:
            print("F")
        elif mid_score+final_score>=80:
            print("A")
        elif mid_score+final_score>=65 and mid_score+final_score<80:
            print("B")
        elif mid_score+final_score>=50 and mid_score+final_score<65:
            print("C")
        elif mid_score+final_score>=30 and mid_score+final_score<50:
            if makeup_score >= 50:
                print("C")
            else:
                print("D")
        elif mid_score+final_score<30:
            print("F")
        
if __name__=="__main__":
    main()

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

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