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

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

    print(res)

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

Solution (Python):
x = 0
list2=[]
for n in range(50):
    list1 = input().split()
    m = int(list1[0])
    n = int(list1[1])
    r = int(list1[2])
    s = m+n
    if m==n==r==-1:
        break
    elif m==-1 or n==-1:
        list2.append('F')
    else:
        if s>=80:
            list2.append('A')
        elif 65<=s<80:
            list2.append('B')
        elif 50<=s<65 or (30<=s<50 and r>=50):
            list2.append('C')
        elif 30<=s<50 and r<50:
            list2.append('D')
        else:
            list2.append('F')
    x += 1

for i in range(x):
    print(list2[i])

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:
    mid, final, makeup = list(map(int, input().split(" ")))
   
    if mid == -1 and final == -1 and makeup == -1:
        break
    elif mid == -1 or final == -1:
            print("F")
    else:
        if mid + final >= 80:
            print("A")
        elif mid + final >=65:
            print("B")
        elif mid + final >= 50:
            print("C")
        elif mid + final >=30:
            if makeup >= 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:
    data = input().split()
    m = int(data[0])
    f = int(data[1])
    r = int(data[2])
    ans = ""

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

    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):
D = map(int, open(0).read().split()[:-3])
for m, f, r in zip(*[iter(D)]*3):
    if m < 0 or f < 0 or m + f < 30:
        print('F')
    elif m + f < 50 and r < 50:
        print('D')
    elif m + f < 65 or (m + f < 50 and r >= 50):
        print('C')
    elif m + f < 80:
        print('B')
    else:
        print('A')

Solution (Python):
students = []
cnt = 0
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    else:
        students.append((m, f, r))
        cnt += 1

for i in range(cnt):
    m, f, r = students[i]
    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')
    else:
        print('D')

Solution (Python):
def end_check(score):
    end_judge = False
    if(score.count("-1") == 3):
        return True
    return end_judge

def evalution_check(score):
    total_score= int(score[0]) + int(score[1])
    re_test_score = int(score[2])

    score_evalution = "F"

    if (score.count("-1") > 1):
        score_evalution = "F"
    elif (total_score >= 80):
        score_evalution = "A"
    elif (total_score >= 65):
        score_evalution = "B"
    elif (total_score >= 50 or re_test_score >= 50):
        score_evalution = "C"
    elif (total_score >= 30):
        score_evalution = "D"


    return score_evalution

def print_evalutions(evalutions):
    for evalution in evalutions:
        print(evalution)

evalutions =[]

while True:
    score = list(input().split())

    if(end_check(score)):
        break

    evalutions.append(evalution_check(score))

print_evalutions(evalutions)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def rank(m, f, r):
        if m == -1 or f == -1:
            return "F"
        total = m + f
        if total >= 80:
            return "A"
        if total >= 65:
            return "B"
        if total >= 50:
            return "C"
        if total >= 30:
            if r >= 50:
                return "C"
            else:
                return "D"
        return "F"

    m, f, r = map(int, input().split())
    while (m, f, r) != (-1, -1, -1):
        print(rank(m, f, r))
        m, f, r = map(int, input().split())

main()

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):
import sys
  
for s in sys.stdin:
    m,f,r = [ int(x) for x in s.split() ]
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    else:
        total = m+f
        if 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')
        elif total < 30:
            print('F')

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

Solution (Python):
while True:
    lst = list(map(int,input().split()))
    m, f, r = lst[0], lst[1], lst[2]
    if m == -1 and f == -1 and r == -1:
        break

    k = m + f

    if m == -1 or f == -1 or k < 30:
        print("F") 

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

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

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

Solution (Python):
grade=[]
while True:
    m,f,r=list(map(int,input().split()))
    if [m,f,r] == [-1,-1,-1]:
        break
    if m==-1 or f==-1:
        grade.append('F')
    elif m+f>=80:
        grade.append('A')
    elif m+f>=65:
        grade.append('B')
    elif m+f>=50:
        grade.append('C')
    elif m+f>=30:
        if r>=50:
            grade.append('C')
        else:
            grade.append('D')
    else:grade.append('F')
print(*grade,sep='\n')

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

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

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

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

    
    i += 1

Solution (Python):
evaluation = []
while True:
    mid, last, re = map(int, input().split(' '))
    if mid == last == re == -1:
        break
    if mid * last < 0 or mid + last < 30:
        evaluation.append('F')
    elif mid + last >= 80:
        evaluation.append('A')
    elif mid + last >= 65:
        evaluation.append('B')
    elif mid + last >= 50 or re >= 50:
        evaluation.append('C')
    else:
        evaluation.append('D')

for grade in evaluation:
    print(grade)

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

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

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

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

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

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

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

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

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

    print(G)

Solution (Python):
total_sum=0

while 1:
    m,f,r=list(map(int, input().split()))
    total_sum=m+r+f
    mid_sum=m+f

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

Solution (Python):
while True:
    m,f,r=map(int,input().split(" "))
    if m+f+r==-3:
        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):
def eval_points(mid, term, re):
    if mid == -1 or term == -1:
        return 'F'
    sum = mid + term
    if sum >= 80:
        return 'A'
    elif sum >= 65:
        return 'B'
    elif sum >= 50 or re >= 50:
        return 'C'
    elif sum >= 30:
        return 'D'
    else:
        return 'F'
        

while True:
    mid, term, re = map(int, input().split())
    if mid == -1 and term == -1 and re == -1:
        break
    evaluation = eval_points(mid, term, re)
    print(evaluation)

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

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

Solution (Python):

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

Solution (Python):
points = []
flag = True
while flag:
    points.append(list(map(int, input().split())))
    if points[-1][0] == points[-1][1] == points [-1][2] == -1:
        flag = False
points.pop()

for p in points:
    if p[0] == -1 or p[1] == -1:
        print('F')
    elif p[0] + p[1] >= 80:
        print('A')
    elif 65 <= p[0] + p[1] < 80:
        print('B')
    elif 50 <= p[0] + p[1] < 65:
        print('C')
    elif 30 <= p[0] + p[1] < 50 and p[2] >= 50:
        print('C')
    elif 30 <= p[0] + p[1] < 50:
        print('D')
    elif p[0] + p[1] <= 30:
        print('F')

Solution (Python):
m=0
f=0
r=0
m,f,r=map(int,input().split())
while m!=-1 or f!=-1 or r!=-1:
    if m!=-1 and f!=-1:
        if 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")
    else:
        print("F")
    m,f,r=map(int,input().split())

Solution (Python):
import sys

while True:
    m, f, r = [int(i) for i in input().split()]
    if m == -1 and f == -1 and r == -1:
        sys.exit()
    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):
m, f, r = [int(i) for i in input().split()]
while not all(i == -1 for i in (m, f, r)):
    if -1 in (m, f):
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        print("C" if r >= 50 else "D")
    else:
        print("F")
    m, f, r = [int(i) for i in input().split()]

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')
        continue
    if m + f >= 65:
        print('B')
        continue
    if m + f >= 50:
        print('C')
        continue
    if m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
        continue

    print('F')

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

for i in score:
    print(i)

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

Solution (Python):
def checker(m, f, r):
    if score >= 80:
        print('A')
    elif score < 30:
        print('F')
    elif score >=65 and score < 80:
        print('B')
    elif score >=30 and score < 50 and r < 50:
        print('D')
    else:
        print('C')

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:
        score = m + f
        checker(m, f, r)

Solution (Python):
class Student:
    def __init__(self, m, f, r):
        self.m = m
        self.f = f
        self.r = r


    def judge(self):
        if self.m == -1 or self.f == -1:
            return 'F'

        total = self.m + self.f
        if total >= 80:
            return 'A'

        if 65 <= total < 80:
            return 'B'

        if 50 <= total < 65:
            return 'C'

        if 30 <= total < 50:
            if self.r >= 50:
                return 'C'
            else:
                return 'D'

        return 'F'


students = []

while True:
    m, f, r = tuple(map(int, input().split(' ')))
    if m == -1 and f == -1 and r == -1:
        break
    students.append(Student(m, f, r))

for student in students:
    print(student.judge())

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

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

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