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

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

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

Solution (Python):
def grade(m, f, r):
    if m==-1 or f == -1:
        return 'F'
    if m+f >= 80:
        return 'A'
    if 65 <= m+f < 80:
        return 'B'
    if 50 <= m+f < 65:
        return 'C'
    if 30 <= m+f < 50:
        if r >= 50:
            return 'C'
        else:
            return 'D'
    if m+f < 30:
        return 'F'


while True:
    x = [int(x) for x in input().split()]
    m, f, r = x
    if m==-1 and f==-1 and r==-1:
        break
    print(grade(m, f, r))

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

Solution (Python):
for e in iter(input, "-1 -1 -1"):
    m, f, r = tuple(map(int, e.split(" ")))
    total = m + f
    if -1 in (m, f):
        print("F")
    elif total >= 80:
        print("A")
    elif 80 > total >= 65:
        print("B")
    elif 65 > total >= 50:
        print("C")
    elif 50 > total >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif total < 30:
        print("F")

Solution (Python):
def judge(a,b):
    if a+b>=80:
        print("A")
    if 65<=a+b<80:
        print("B")
    if 50<=a+b<65:
        print("C")
    if 30<=a+b<50 and c<50:
        print("D")
    if 30<=a+b<50 and c>=50:
        print("C")
    if a+b<30:
        print("F")

while True:
    a,b,c=map(int, input().split())
    if a==b==c==-1:
        break
    if a==-1 or b==-1:
        print("F")
    if a!=-1 and b!=-1:
        judge(a,b)

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


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 and r >= 50:
        print("C")
        
    elif m + f >= 30 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:
        exit ()
    
    if m == -1 or f == -1:
        print ("F")
    elif 80 <= m+f:
        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):
a = []
for i in iter(input, '-1 -1 -1'):
    a.append(list(map(int, i.split())))
for i in range(len(a)):
    if (a[i][0] == -1) | (a[i][1] == -1):
        print('F')
    elif a[i][0]+a[i][1] >= 80:
        print('A')
    elif 65 <= a[i][0]+a[i][1] < 80:
        print('B')
    elif (50 <= a[i][0]+a[i][1] < 65) | ((30 <= a[i][0]+a[i][1] < 50) & (a[i][2] >= 50)):
        print('C')
    elif 30 <= a[i][0]+a[i][1] < 50:
        print('D')
    else:
        print('F')

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

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

Solution (Python):
while True:
    
    m,f,r = (int(i) for i in input().split())
    
    if m==-1 & f==-1 & 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')
    if m != -1 and f!=-1:
        if 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')
        elif m+f<30:
            print('F')

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

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)






def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




str_list = []

while True:
    mid, term, make= map(int, input().split())
    if mid == -1 and term == -1 and make == -1:
        break

    if mid == -1 or term == -1:
        str_list.append("F")
        continue

    score = mid+term
    if score < 30:
        str_list.append("F")
    elif score < 50:
        if make >= 50:
            str_list.append("C")
        else:
            str_list.append("D")
    elif score < 65:
        str_list.append("C")
    elif score < 80:
        str_list.append("B")
    else:
        str_list.append("A")

for i in range(len(str_list)):
    if i == len(str_list)-1:
        print(str_list[i])
    else:
        print(str_list[i])

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

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

for result in results:
    m, f, r = result[0], result[1], result[2]
    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 >= 65:
        print("B")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())

while 1:
    m,f,r = LI()
    if m==f==r==-1:
        break
    if m==-1 or f==-1:
        print('F')
    elif 80<=m+f:
        print('A')
    elif 65<=m+f:
        print('B')
    elif 50<=m+f or 50<=r:
        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+f>=80:
        print("A")
    elif m==-1 or f==-1:
        print("F")
    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")
    else:
        print("F")

Solution (Python):
L = []
m,f,r = map(int, input().split())
while m != -1 or f != -1 or r != -1:
    L.append([m,f,r])
    m, f, r = map(int, input().split())
for i in range(len(L)):
    if L[i][0] == -1 or L[i][1] == -1:
        print('F')
    elif L[i][0]+L[i][1] >= 80:
        print('A')
    elif L[i][0]+L[i][1] >= 65:
        print('B')
    elif L[i][0]+L[i][1] >= 50 or L[i][2] >= 50:
        print('C')
    elif L[i][0]+L[i][1] >= 30:
        print('D')
    else:
        print('F')

Solution (Python):
import sys

while True:
    lst = list(map(int, input().split()))
    total = lst[0] + lst[1]

    ans = ''
    if sum(lst) == -3:
        sys.exit(0)
    if lst[0] == -1 or lst[1] == -1:
        print('F')
        continue

    if total >= 80:
        ans = 'A'
    elif 65 <= total < 80:
        ans = 'B'
    elif 50 <= total < 65:
        ans = 'C'
    elif 30 <= total < 50:
        if lst[2] >= 50:
            ans = 'C'
        else:
            ans = 'D'
    elif 0 <= total <= 30:
        ans = 'F'
    else:
        pass
    
    print(ans)

Solution (Python):

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

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

for i in grad:
    print(i)

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

Solution (Python):
a = []
while True:
    m,f,r = map(int, input().split())
    if m == f == r == -1:
        break
    s = m + f
    if 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")

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

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

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

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

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

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

Solution (Python):
n = 0
student = []
while True:
  m,f,r = map(int, input().split())

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

for i in range(n):
  print(str(student[i]))

Solution (Python):
count = 0
info = []
ans = []
while True:
  info.append(list(map(int, input().split())))
  if info[count][0] == -1 and info[count][1] == -1 and info[count][2] == -1:
    break
  count += 1
for i in info:
  if (i[0] + i[1]) < 30 or i[0] == -1 or i[1] == -1:
    ans.append("F")
  elif 80 <=(i[0] + i[1]):
    ans.append("A")
  elif 65 <= (i[0] + i[1]) < 80:
    ans.append("B")
  elif 50 <= (i[0] + i[1]) < 65:
    ans.append("C")
  elif 30 <= (i[0] + i[1]) < 50:
    if 50 <= i[2]: 
      ans.append("C")
    else:
      ans.append("D")
  else:
    ans.append("F")
ans.pop()
for j in ans:
  print(j)

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

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

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
while True:
    x = list(map(int,input().split()))
    a = x[0]
    b = x[1]
    c = x[2]

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

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

for i in range(len(score)):
    m, f, r = score[i][0], score[i][1], score[i][2]
    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())
  
  s = m + f
  
  if m == -1 and f == -1:
  	break

  if m == -1 or f == -1:
  	grade = 'F'
  elif s >= 80:
  	grade = 'A'
  elif s >= 65 and s < 80:
  	grade = 'B'
  elif s >=50 and s < 65:
  	grade = 'C'
  elif s >=30 and s < 50:
  	grade = 'D'
  	if r >= 50:
  		grade = 'C'
  else:
  	grade = 'F'

  print(grade)

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

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

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

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

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


while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    else:
        print(judge(m, f, 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:
    m,f,r = map(int,input().split())
    if m == f == 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 or (65 > m + f >= 30 and r >= 50):
        print('C')
        continue
    if m + f >= 30:
        print('D')
        continue
    if m + f < 30:
        print('F')

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

Solution (Python):
while(True):
    sc = input().split()
    m = int(sc[0])
    f = int(sc[1])
    r = int(sc[2])
    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) 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 == 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==f==r==-1:
        break
    elif (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")