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 = [int(x) for x in 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, 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 1:
 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 == -1: m = 0
 elif f == -1: f = 0

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

m,f,r = 0,0,0
result = []
count = 0
while True:
    count+=1
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        result.append("F")
        continue
    elif 80 <= m+f:
        result.append("A")
        continue
    elif 65 <= m+f < 80:
        result.append("B")
        continue
    elif 50 <= m+f < 65:
        result.append("C")
        continue
    elif 30 <= m+f < 50:
        if 50 <= r:
            result.append("C")
            continue
        else:
            result.append("D")
            continue
    else:
        result.append("F")

for i in range(count-1):
    print(result[i])

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 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==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:
    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 80 <= m + f:
        print('A')

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

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

    elif 30 <= m + f:
        print('DC'[50 <= r])

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 = input()
    b = a.split()
    m = int(b[0])
    f = int(b[1])
    r = int(b[2])
    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
	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 and r >=50:
		print("C")
	elif m+f>=30:
		print("D")
	else:
		print("F")

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

Solution (Python):
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) :
   if(50 <= 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, -1, -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):
grades = ['A','B','C','D','F']

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(grades[4])
    elif m + f >= 80:
        print(grades[0])
    elif m + f >= 65:
        print(grades[1])
    elif m + f >= 50:
        print(grades[2])
    elif m + f >= 30:
        if r >= 50:
            print(grades[2])
        else:
            print(grades[3])
    else:
        print(grades[4])

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

Solution (Python):
while True:
    m, f, r = list(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 (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):
n=0
S={}
while True:
    L1=input().split( )
    L=[int(s) for s in L1]
    if L==[-1,-1,-1]:
        break
    S[n]=L
    n+=1
l=len(S)
for i in range(l):
    m=S[i][0]
    f=S[i][1]
    r=S[i][2]
    S[i].append("")
    if m==-1 or f==-1:
        S[i][3]=S[i][3]+"F"
    elif m+f>=80:
        S[i][3]=S[i][3]+"A"
    elif 80>m+f>=65:
        S[i][3]=S[i][3]+"B"
    elif 65>m+f>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r>=50:
        S[i][3]=S[i][3]+"C"
    elif 50>m+f>=30 and r<50:
        S[i][3]=S[i][3]+"D"
    else:
        S[i][3]=S[i][3]+"F"
for i in range(l):
    print(S[i][3])

Solution (Python):






import sys
import math
import array


class mymath:
    
    pi = 3.14159265358979323846264338

    
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()


class output:
    
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()
















def main():
    A = []

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

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

Solution (Python):
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul
from bisect import* 
from heapq import* 
from math import factorial,pi
from copy import deepcopy
import sys

sys.setrecursionlimit(10**6)


def main():
    while 1:
        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")
            continue
        if a+b>=80:
            print("A")
        if 80>a+b>=65:
            print("B")
        if 65>a+b>=50:
            print("C")
        if 50>a+b>=30:
            if c>=50:
                print("C")
            else:
                print("D")
        if a+b<30:
            print("F")
    
    

if __name__ == '__main__':
    main()

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

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

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    if all(i == -1 for i in (m, f, r)):
        break
    if any(i == -1 for i in (m, f)):
        rank = 'F'
    else:
        score = m + f
        if score >= 80:
            rank = 'A'
        elif score >= 65:
            rank = 'B'
        elif score >= 50:
            rank = 'C'
        elif score >= 30:
            if r >= 50:
                rank = 'C'
            else:
                rank = 'D'
        else:
            rank = 'F'
    print(rank)

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

Solution (Python):
seito_tensu = []
tensu = []
seito = 0
while seito < 50:
    m, f, r = [int(e) for e in input().split()]
    seito += 1
    if m==-1and f==-1 and r==-1:
        break
    else:
        seito_tensu = [m, f, r]
        tensu.append(seito_tensu)
        
for x in range(len(tensu)):
    if tensu[x][0]==-1 or tensu[x][1]==-1:
        print("F")
    elif tensu[x][0]+tensu[x][1]>=80:
        print("A")
    elif tensu[x][0]+tensu[x][1]>=65 and tensu[x][0]+tensu[x][1]<80:
        print("B")
    elif tensu[x][0]+tensu[x][1]>=50 and tensu[x][0]+tensu[x][1]<65:
        print("C")
    elif tensu[x][0]+tensu[x][1]>=30 and tensu[x][0]+tensu[x][1]<50:
        if tensu[x][2]>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
while True:
    a = input()
    a = a.split(" ")
    for i in range(len(a)):
        a[i] = int(a[i])
    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] >= 65 and a[0] + a[1] < 80:
        print("B")
    elif a[0] + a[1] >= 50 and a[0] + a[1] < 65:
        print("C")
    elif a[0] + a[1] >= 30 and a[0] + a[1] < 50 and a[2] >=50:
        print("C")
    elif a[0] + a[1] >= 30 and a[0] + a[1] < 50 and a[2] <50:
        print("D")
    elif a[0] + a[1] < 30:
        print("F")

Solution (Python):
judge = []

while True:
    test_input = list(map(int, input().split()))
    if(test_input[0] == -1 and test_input[1] == -1 and test_input[2] == -1):
        break
    score = test_input[0] + test_input[1]
    if (score >= 80) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("A")
    elif (score >= 65 and score < 80) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("B")
    elif (score >= 50 and score < 65) and not(test_input[0] == -1 or test_input[1] == -1):
        judge.append("C")
    elif (score >= 30 and score < 50) and not(test_input[0] == -1 or test_input[1] == -1):
        if test_input[2] >= 50:
            judge.append("C")
        else:
            judge.append("D")
    else:
        judge.append("F")

for j in judge:
    print(j)

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

Solution (Python):
while True :
  m,f,r = map(int,input().split())
  x = m + f
  
  if m == f == r == -1 :
    break
  elif m == -1 or f == -1 :
    print('F')

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

        print("{}".format(arc))

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

    print(grade)

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

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

Solution (Python):
def grading(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    total = m + f
    if total < 30:
        return 'F'
    elif total < 50:
        if 50 <= r:
            return 'C'
        return 'D'
    elif total < 65:
        return 'C'
    elif total < 80:
        return 'B'
    else:
        return 'A'

if __name__ == "__main__":
    while True:
        m, f, r = map(int, input().split())
        if m == f == r == -1:
            break

        print(grading(m, f, r))

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

Solution (Python):


"""
Created on Mon Apr 15 22:45:08 2019

@author: mac
"""
grades = []
count = 0

while(count == 0):
    scores = list(map(int, input().split(" ")))
    if scores[0] == -1 and scores[1] == -1 and scores[2] == -1:
        count += 1
    grades.append(scores)

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

Solution (Python):
import sys
for l in sys.stdin:
	if l == '-1 -1 -1\n': break
	m,f,r = map(int, l.split())
	s = m + f
	if -1 in [m,f]: g = 'F'
	elif s >= 80: g = 'A'
	elif s >= 65: g = 'B'
	elif s >= 50: g = 'C'
	elif s >= 30: g = 'D' if r < 50 else 'C'
	else: g = 'F'
	print(g)

Solution (Python):

while True:
    x = input()
    list = x.split()
    [m, f, r] = list
    m = int(m)
    f = int(f)
    r = int(r)
    mf = m + f
    mfr = m + f + r
    
    
    if mfr ==  -3:
        break
    
    
    
    
    if m == -1 or f == -1:
        ans = "F"
    
    
    
    elif mf >= 80:
        ans = "A"
    
    
    elif mf >= 65:
        ans = "B"
    
    
    elif mf >= 50:
        ans = "C"
    
    
    elif mf < 30:
        ans = "F"
    
    
    elif mf >= 30 and r >= 50:
        ans = "C"
    
    
    elif mf >=30 and r < 50:
        ans = "D"
    
    
    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");
    else:
        sum = M + F;
        if sum >= 80:
            print("A");
        elif sum >= 65:
            print("B");
        elif sum >= 50:
            print("C");
        elif sum >= 30 and R < 50:
            print("D");
        elif sum >= 30 and R >= 50:
            print("C");
        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 or m + f < 30:
        print('F')
    elif 80 <= m+f:
        print('A')
    elif 65 <= m+f:
        print('B')
    elif 50 <= m+f or r >=50:
        print('C')
    elif 30 <= m+f:
        print('D')

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

Solution (Python):
def grading(mid, final, re_exam):   
    if mid == -1 or final == -1:
        return 'F'

    reg_score = mid + final

    if reg_score >= 80:
        return 'A'
    elif reg_score >= 65 and reg_score < 80:
        return 'B'
    elif reg_score >= 50 and reg_score < 65:
        return 'C'
    elif reg_score >= 30 and reg_score < 50:
        if re_exam >= 50:
            return 'C'
        else :
            return 'D'
    else :
        return 'F'
    

while True :
    test_results = [int(i) for i in input().split()]
    mid = test_results[0]
    final = test_results[1]
    re_exam = test_results[2]
    sentinel = mid + final + re_exam
    
    if sentinel == -3:
        break 
    else :
        grade = grading(mid, final, re_exam)
        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 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 == -1 and f == -1 and r == -1:break

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

Solution (Python):
while True:
    try:
        m, f, r = list(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:
            print('B')
        elif m+f >= 50 or r >= 50:
            print('C')
        elif m+f >= 30:
            print('D')
    except:
        break

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 < 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):
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:
    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):
eva = []
count = 0

while True:
    m, f, r = map(int, input().split())
    sum = m + f
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m != -1 and f != -1:
            if sum >= 30:
                if 30 <= sum < 50:
                    if r < 50:
                        eva.append("D")
                    else:
                        eva.append("C")
                elif 50 <= sum < 65:
                    eva.append("C")
                elif 65 <= sum < 80:
                    eva.append("B")
                elif 80 <= sum:
                    eva.append("A")
            else:
                eva.append("F")
        else:
            eva.append("F")
    count += 1

for i in range(count):
    print(eva[i])