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
    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):
lis=[]

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

for i in lis:
	m,f,r=i[0],i[1],i[2]
	res=""
	if m==-1 or f==-1:
		res="F"
	elif 30<=m+f and m+f < 50:
		if 50<=r:
			res="C"
		else:
			res="D"
	elif 50<=m+f and m+f<65:
		res="C"
	elif 65 <= m+f < 80:
		res="B"
	elif 80<= m+f:
		res="A"
	elif m+f < 30:
		res="F"

	print(res)

Solution (Python):

def exe_grading():
    
    grade_list=[]
    
    while True:
        
        m,f,r=tuple(map(int,input().split()))

        if m==-1 and f==-1 and r ==-1:
            break
        
        
        grade_list.append((m,f,r))
        
    for m,f,r in grade_list:
        score=m+f
        if m==-1 or f ==-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 r>=50:
                print("C")
            else:
                print("D")
        else:
            print("F")
        
exe_grading()

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

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

Solution (Python):



while True:
    m,f,r = map(int,input().split())
    if m==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")
    elif m+f<30: print("F")

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

for result in results:
    if result[0] == -1 or result[1] == -1:
        print('F')
    else:
        if result[3] >= 80:
            print('A')
        elif result[3] >= 65:
            print('B')
        elif result[3] >= 50:
            print('C')
        elif result[3] >= 30:
            if result[2] >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')

Solution (Python):
scr = []
for x in range(51):
    scr.append(list(map(int, input().split())))
    if scr[x][0] == -1 and scr[x][1] == -1 and scr[x][2] == -1:
        break
ans = []

for x in range(len(scr)-1):
    if scr[x][0] == -1 or scr[x][1] == -1:
        ans.append("F")
    elif scr[x][0] + scr[x][1] >= 80:
        ans.append("A")
    elif scr[x][0] + scr[x][1] >= 65:
        ans.append("B")
    elif scr[x][0] + scr[x][1] >= 50:
        ans.append("C")
    elif scr[x][0] + scr[x][1] >= 30 and scr[x][2] >= 50:
        ans.append("C")
    elif scr[x][0] + scr[x][1] >= 30 and scr[x][2] < 50:
        ans.append("D")
    elif scr[x][0] + scr[x][1] < 30:
        ans.append("F")

for x in range(len(ans)):
    print(ans[x])

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

Solution (Python):

while True:
    m, f, r = map(int, input().split())
    if m+f+r==-3:
        break

    if m==-1 or f==-1:
        print('F')

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

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

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

Solution (Python):
for e in iter(input, "-1 -1 -1"):
    
    m,f,r=map(int, e.split())

    result = ""

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

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:
        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 or r >= 50:
        print('C')

    elif m + f < 50 and m + f >= 30:
        print('D')

    elif m + f < 30:
        print('F')

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

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

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

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

    elif m+f >= 80:
        print("A")

    elif 80 > m+f >= 65:
        print("B")

    elif 65 > m+f >= 50:
        print("C")

    elif 50 > m+f >=30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):


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

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

    if m < 0 or f < 0:
        grade = 'F'
    elif m + f >= 80:
        grade = 'A'
    elif m + f >= 65:
        grade = 'B'
    elif m + f >= 50:
        grade = 'C'
    elif m + f >= 30:
        if r >= 50:
            grade = 'C'
        else:
            grade = 'D'
    else:
        grade = 'F'
    print(grade)

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

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

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

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

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

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

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

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

for i in grade:
    print(i)

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

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

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

Solution (Python):
def main_v1():
    grade = ""
    while True:
        mid, final, re = map(int, input().split())
        if mid == -1 and final == -1 and re == -1:
            break
        if mid == -1 or final == -1:
            grade = "F"
        elif mid + final >= 80:
            grade = "A"
        elif mid + final >= 65:
            grade = "B"
        elif mid + final >= 50:
            grade = "C"
        elif mid + final >= 30:
            if re >= 50:
                grade = "C"
            else:
                grade = "D"
        else:
            grade = "F"
        print(grade)
    return 0

if __name__ == "__main__":
    main_v1()

Solution (Python):
while True:
    m, f, r = (int(x) for x in input().split())
    if m == -1 or f == -1:
        if m == f == r == -1:
            break
        else:
            print('F')
    else:
        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')
        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 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")
    elif m + f < 30:
        print("F")

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

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

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

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

Data = []

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

for a in Data:
    print(judge(a[0],a[1],a[2]))

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

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:
  s = list(map(int,input().split()))
  if sum(s) == -3:
    break
  if s[0] == -1 or s[1] == -1:
    print('F')
    continue
  if (s[0] + s[1]) >= 80:
    print('A')
  elif (s[0] + s[1]) >= 65:
    print('B')
  elif (s[0] + s[1]) >= 50:
    print('C')
  elif (s[0] + s[1]) >= 30:
    if s[2] >= 50:
      print('C')
    else:
      print('D')
  else:
    print('F')

Solution (Python):
for i in range(1,51):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        print("F")
    elif m+f>=80:
        print("A")
    elif m+f>=65 and m+f<80:
        print("B")
    elif m+f>=50 and m+f<65:
        print("C")
    elif m+f>=30 and m+f<50:
        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) >= 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 = list(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  total >= 65 and total < 80:
        print('B')
    elif total >= 50 and total < 65:
        print('C')
    elif total >= 30 and total < 50 and R >= 50:
        print('C')
    elif total >= 30 and total < 50:
        print('D')
    else:
        print('F')

Solution (Python):
def devide_grade(m,f,r):
    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")
        
c = 0

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

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

Solution (Python):
m = []
f = []
r = []

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

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

for i in range(len(m)):
    print(grade(m[i], f[i], r[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 80 <= m+f:
        print("A")
    elif 65 <= m + f:
        print("B")
    elif 50 <= m + f:
        print("C")
    elif (30 <= m + f ) and r >= 50:
        print("C")
    elif 30 <= m + f:
        print("D")
    else:
        print("F")

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


if __name__ == '__main__':
    main()

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

Solution (Python):
Data = []

while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    else:
        Data.append(list((m, f, r)))
        
Judge = []

for data in Data:
    m, f, r = data[0], data[1], data[2]
    if m + f >= 80:
        Judge.append('A')
    elif (m == -1 or f == -1) or (m + f < 30):
        Judge.append('F')
    elif 65 <= m + f < 80:
        Judge.append('B')
    elif 50 <= m + f < 65 or (30 <= m + f < 50 and r >= 50):
        Judge.append('C')
    elif 30 <= m + f < 50 and r < 50:
        Judge.append('D')

for judge in Judge:
    print(judge, end='\n')