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

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

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

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

for i in range(50):
    
    m,f,r=list(map(float, input().split()))
    x=m+f
    if m==-1 and f==-1 and r==-1:
        break
    
    elif m==-1 or f==-1 :
        print("F")
        
    elif x>=80 :
        print("A")
    
    elif 80>x>=65 :
        print("B")
    
    elif 65>x>=50 :
        print("C")
        
    elif 50>x>=30 :
        if r>=50 :
            print("C")
        else :
            print("D")
    else :
        print("F")

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

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

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

Solution (Python):
while True:
    num_str = input().split()
    m, f, r = [int(i) for i in num_str]
    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("D")
        else:
            print("C")
    else:
        print("F")

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

for i in range(len(list_m)):
    M=list_m[i]
    F=list_f[i]
    R=list_r[i]
    score=M+F
    if M==-1 or F==-1:
        grade="F"
    elif score>=80:
        grade="A"
    elif 65<= score <80:
        grade="B"
    elif 50<= score <65:
        grade="C"
    elif 30<= score <50:
        if R>=50:
            grade="C"
        else:
            grade="D"
    else:
        grade="F"
    print(grade)

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

Solution (Python):
m,f,r = [],[],[]
grade = []
while True:
	a,b,c = map(int,input().split())
	if a == -1 and b == -1 and c == -1:
		break
	else:
		m.append(a)
		f.append(b)
		r.append(c)
for i in range(len(m)):
	if m[i] == -1 or f[i] == -1:
		grade.append("F")
	elif m[i] + f[i] >= 80:
		grade.append("A")
	elif m[i] + f[i] >= 65:
		grade.append("B")
	elif m[i] + f[i] >= 50 or r[i] >= 50:
		grade.append("C")
	elif m[i] + f[i] >= 30:
		grade.append("D")
	else:
		grade.append("F")
for k in grade:
	print(k)

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

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

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

for i in data:
  print(i)

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

Solution (Python):
def grade(half, end, reexam):
    points = half + end
    if half == -1 or end == -1:
        return 'F'
    else:    
        if points >= 80:
            return 'A'
        elif points >= 65:
            return 'B'
        elif points >= 50:
            return 'C'
        elif points >= 30:
            if reexam >= 50:
                return 'C'
            else:
                return 'D'
        else:
            return 'F'

while 1:
    half, end, reexam = map(int, input().split())
    if half == end == reexam == -1:
        break
    else:
        print(grade(half, end, reexam))

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

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

Solution (Python):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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")
    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 and r<50:print("D")
    elif 30>m+f: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 == 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 or f==-1:
        if m==-1 and f==-1 and r==-1:
          break
        else:
          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):
for _ in range(50):
    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
   
   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")
   else:
      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):
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")
    else :
        print("F")

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

Solution (Python):

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

Solution (Python):
while True:
    m,f,r = (int(x) for x in 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 >= 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
    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):
while True:
    m,f,r = (int(x) for x in 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 >= 30 and r >= 50):
        print("C")
    elif m + f >= 30:
        print("D")
    else:
        print("F")

Solution (Python):
readline = open(0).readline
ans = []
while 1:
    m, f, r = map(int, readline().split())
    if m == f == r == -1:
        break
    v = m+f
    if m == -1 or f == -1 or v < 30:
        ans.append("F\n")
    elif v >= 80:
        ans.append("A\n")
    elif v >= 65:
        ans.append("B\n")
    elif v >= 50 or (v >= 30 and r >= 50):
        ans.append("C\n")
    else:
        ans.append("D\n")
open(1, 'w').writelines(ans)

Solution (Python):
while True:
    m,f,r=map(int,input().split())
    if(m,f,r)==(-1,-1,-1):
        break
    x=m+f
    if m<0 or f<0:
        print("F")
    elif x<30:
        print("F")
    elif x>=80:
        print("A")
    elif x>=65:
        print("B")
    elif x>=50:
        print("C")
    elif 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
    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 == f == r == -1:
        break
    
    if 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):
l=[]
while True:
  e = list(map(int,input().split()))
  if e==[-1, -1, -1]:
    break
  l.append(e)

for i in range(0, len(l)):
  t = l[i]
  if t[0] == -1 or t[1] == -1:
    print("F")
  elif t[0] + t[1] >= 80:
    print("A")
  elif t[0] + t[1] >= 65 and t[0] + t[1] < 80:
    print("B")
  elif t[0] + t[1] >= 50 and t[0] + t[1] < 65:
    print("C")
  elif t[0] + t[1] >= 30 and t[0] + t[1] < 50:
    if t[2] >= 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:
        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 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 = 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 or f != -1 or r != -1:
        x = max(0, m) + max(0, f)
        if m == -1 or f == -1:
            grade = 'F'
        elif 80 <= x:
            grade = 'A'
        elif 65 <= x and x < 80:
            grade = 'B'
        elif 50 <= x and x < 65:
            grade = 'C'
        elif 30 <= x and x < 50:
            if 50 <= r:
                grade = 'C'
            else:
                grade = 'D'
        else:
            grade = 'F'
        print(grade)
    else:
        break

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

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

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

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, 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:
        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):
def mapt(fn, *args):
    return tuple(map(fn, *args))
    
    
def calc_grades(m, f, r):
    if m == -1 or f == -1: return "F"
    elif m + f >= 80: return "A"
    elif m + f >= 65: return "B"
    elif m + f >= 50: return "C"
    elif m + f >= 30 and r >= 50: return "C"
    elif m + f >= 30: return "D"
    elif m + f < 30: return "F"


def Input():
    while True:
        m, f, r= mapt(int, input().split(" "))
        if m == f == r == -1: break
        print(calc_grades(m, f, r))


Input()

Solution (Python):




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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
while True:
    x , y , z = map(int,input().split())
    if x == y == z == -1 :
        break
    
    if x == -1:
        print("F")
        
    elif y == -1:
        print("F")
    
    elif z >= 50 :

        if x + y >=30:
            print("C")

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

Solution (Python):
import math
while True:
    a,b,c=map(float,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 80>(a+b) and (a+b)>=65:
        print("B")
    elif 65>(a+b) and (a+b)>=50:
        print("C")
    elif c>=50:print("C")
    elif 50>(a+b) and (a+b)>=30:
        print("D")
    elif 30>(a+b):
        print("F")

Solution (Python):

while True :
    m, f, r = (int(x) for x in input().split())
    sum = m + f

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

    elif (m == -1 or f == -1):
        print("F")

    elif (sum >= 80):
        print("A")

    elif (sum >= 65 and sum < 80):
        print("B")

    elif (sum >= 50 and sum < 65):
        print("C")

    elif (sum >= 30 and sum < 50):
        if (r >= 50):
            print("C")
        elif (r < 50):
            print("D")

    elif (sum < 30):
        print("F")