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

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

Solution (Python):
mfr = []
while True:
    a, b, c = map(int, input().split())
    if a == -1 and b == -1 and c == -1:
        break
    mfr.append([a, b, c])
res = []
for i in range(len(mfr)):
    tmp = mfr[i][0]+mfr[i][1]
    if mfr[i][0] == -1 or mfr[i][1] == -1:
        res.append('F')
    elif tmp >= 80:
        res.append('A')

    elif 65 <= tmp and tmp < 80:
        res.append('B')

    elif 50 <= tmp and tmp < 65:
        res.append('C')

    elif 30 <= tmp and tmp < 50:
        if 50 <= mfr[i][2]:
            res.append('C')
        else:
            res.append('D')

    elif tmp < 30:
        res.append('F')


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

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

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

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

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

Solution (Python):
while True:
    x = list(map(int,input().split(' ')))
    if x[0] + x[1] + x[2] == -3:
        break
    elif x[0] == -1 or x[1] == -1:
        print('F',end='\n')
    elif x[0] + x[1] >= 80:
        print('A',end='\n')
    elif x[0] + x[1] >= 65 and x[0] + x[1] < 80:
        print('B', end='\n')
    elif x[0] + x[1] >= 50 and x[0] + x[1] < 65:
        print('C', end='\n')
    elif x[0] + x[1] >= 30 and x[0] + x[1] < 50 and x[2] < 50:
       print('D', end='\n')
    elif x[0] + x[1] >= 30 and x[0] + x[1] < 50 and x[2] >= 50:
        print('C', end='\n')
    elif x[0] + x[1] < 30:
        print('F', end='\n')

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

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

    test_result = r+m
    end_flag=r+m+f
    if end_flag==-3:
        break
    elif r == -1 or m == -1:
        print('F')
    elif 80 <= test_result:
        print('A')
    elif (65 <= test_result) and (test_result < 80):
        print('B')
    elif (50 <= test_result) and (test_result < 65):
        print('C')
    elif (30 <= test_result) and (test_result < 50) and (50 <= f):
        print('C')
    elif (30 <= test_result) and (test_result < 50):
        print('D')
    elif test_result  <30:
        print('F')

Solution (Python):
cons=[[0,0,0,0] for i in range(50)]
for i in range(50):
    a,b,c = list(map(int,input().split()))
    if (a+1)*(a+1) + (b+1)*(b+1) + (c+1)*(c+1) == 0:
        break
    asse = 'N'
    if (a == -1) + (b == -1):
        asse = 'F'
    elif a+b < 30:
        asse = 'F'
    elif (a+b <50)*(c < 50):
        asse = 'D'
    elif (a+b<65):
        asse='C'
    elif a+b < 80:
        asse='B'
    elif a+b >= 80:
        asse='A'
    cons[i] = [a,b,c,asse]
for j in range(i):
    print(cons[j][3])

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

Solution (Python):
while 1:
    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 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 = map(int, input().split())
    
    if m == -1 and f == -1 and r == -1 :
        break
    else :
        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):
m =[]
f =[]
r=[]
for i in range(50):
    m_score,f_score,r_score = map(int,input().split())
    if m_score+f_score+r_score == -3:
        break
    else:
        m.append(m_score)
        f.append(f_score)
        r.append(r_score)

for j in range(len(m)):

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

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

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

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

for p in g:
    print(p)

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

    elif m == -1 or r == -1:
        list.append("F")

    elif m+r >= 80:
        list.append("A")

    elif 65 <= m+r < 80:
        list.append("B")

    elif 50 <= m+r < 65:
            list.append("C")

    elif 30 <= m+r < 50:
        if f >= 50:
            list.append("C")
        else:
            list.append("D")

    elif  m+r < 30:
            list.append("F")

[print(i) for i in list]

Solution (Python):

M = []
F = []
R = []
grade = []
m = 0; f = 0; r = 0
while 1:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break
    M.append(m)
    F.append(f)
    R.append(r)


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

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

    print(result)

Solution (Python):
seiseki = []
seisekid = {1:"F",2:"D",3:"C",4:"B",5:"A"}
while True:
    x,y,z = input().split(" ")
    x = int(x)
    y = int(y)
    z = int(z)
    q = x + y + z
    i = x + y
    if q == -3:
        for t in range(len(seiseki)):
            r = t - 1
            print(seisekid[seiseki[t]])
        break
    elif x == -1:
        seiseki.append(1)
        continue
    elif y == -1:
        seiseki.append(1)
        continue
    elif i < 30:
        seiseki.append(1)
        continue
    elif i >= 30:
        if i >= 50:
            if i >= 65:
                if i >= 80:
                    seiseki.append(5)
                    continue
                else:
                    seiseki.append(4)
                    continue
            else:
                seiseki.append(3)
                continue
        elif z >= 50:
            seiseki.append(3)
            continue
        else:
            seiseki.append(2)
            continue
    else:
        seiseki.append(1)

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

Solution (Python):

while True :
  m,f,e = map(int, input().split())
  if m == -1 and f == -1 and e == -1 :
    break
  
  t = m + f
  if m == -1 or f == -1 :
    print("F")
    continue

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

Solution (Python):
m,f,r = map(int,input().split())

while m + f + r != -3 :

    if m * f < 0 :
        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")

    m,f,r = map(int,input().split())

Solution (Python):
result = list()
while(True):
    score = list(map(int,input().split()))

    if sum(score) == -3:
        break
    if score[0] == -1 or score[1] == -1:
        result.append("F")
    elif score[0]+score[1] >= 80:
        result.append("A")
    elif score[0]+score[1] >= 65:
        result.append("B")
    elif score[0]+score[1] >= 50:
        result.append("C")
    elif score[0]+score[1] >= 30:
        if score[2] >= 50:
            result.append("C")
        else:
            result.append("D")
    else:
        result.append("F")
for i in range(len(result)):
    print(result[i])

Solution (Python):
list_MFR = list()
while True:
    base = input()
    term = base.split(' ')
    if(int(term[0]) == -1 and int(term[1]) == -1 and int(term[2]) == -1):
        break
    else:
        map_MFR = {'M': int(term[0]), 'F': int(term[1]), 'R': int(term[2])}
        list_MFR.append(map_MFR)

for s in list_MFR:
    if s['M'] == -1 or s['F'] == -1:
        print('F')
    elif s['M'] + s['F'] >= 80:
        print('A')
    elif s['M'] + s['F'] >= 65 and s['M'] + s['F'] < 80:
        print('B')
    elif s['M'] + s['F'] >= 50 and s['M'] + s['F'] < 65:
        print('C')
    elif s['M'] + s['F'] >= 30 and s['M'] + s['F'] < 50:
        if s['R'] >= 50:
            print('C')
        else:
            print('D')
    elif s['M'] + s['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 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,r,f = map(int, input().split()) 
    result = ''
    if m == -1 and r == -1 and f == -1:
        break
    if m == -1 or r == -1:
        result = 'F'
    elif m + r >= 80:
        result = 'A'
    elif  m + r >= 65 and m + r < 80:
        result = 'B'
    elif  m + r >= 50 and m + r < 65:
        result = 'C'
    elif  m + r >= 30 and m + r < 50:
        if f >= 50:
            result = 'C'
        else:
            result = 'D'
    else:
        result = 'F'
    print(result)

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

Solution (Python):


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

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

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

for result in res:
    print(result)

Solution (Python):
def evaluate_mark(scores):
    if scores[0] == -1 or scores[1] == -1:
        return 'F'

    total = scores[0] + scores[1]

    if 80 <= total:
        return 'A'
    elif 65 <= total < 80:
        return 'B'
    elif 50 <= total < 65:
        return 'C'
    elif 30 <= total < 50:
        if 50 <= scores[2]:
            return 'C'
        else:
            return 'D'
    else:
        return 'F'


if __name__ == "__main__":
    student_score_list = []

    absence_code = -1

    while True:
        score_input = input()

        scores = list(map(int, score_input.split()))

        if all(map(lambda score: score == -1, scores)):
            break

        student_score_list.append(scores)

    marks = list(map(evaluate_mark, student_score_list))

    for mark in marks:
        print(mark)

Solution (Python):
student = []

for _ in range(50):
    m, f, r = list(map(int, input().split()))
    if m == -1 and f == -1 and r == -1:
        break
    student.append([m, f, r])

for i in range(len(student)):
    if student[i][0] == -1 or student[i][1] == -1:
        print("F")
        continue

    sum_stu = student[i][0] + student[i][1]
    if sum_stu >= 80:
        print("A")
    elif 80 > sum_stu >= 65:
        print("B")
    elif 65 > sum_stu >= 50:
        print("C")
    elif 50 > sum_stu >= 30:
        if student[i][2] >= 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())
    s = m + f
    if m == f == r == -1:break
    if m == -1 or f == -1:
        score = "F"
    elif s >= 80:
        score = "A"
    elif 65 <= s <80:
        score = "B"
    elif 50 <= s < 65:
        score = "C"
    elif 30 <= s < 50 and r >= 50:
        score = "C"
    elif 30 <= s < 50:
        score = "D"
    else:
        score = "F"
    print(score)

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

Solution (Python):
import sys
import math
i=0
while i<50:
    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')
    i=i+1

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

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

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

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

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

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

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

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

Solution (Python):
out = []

for _ in range(50):
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if -1 in (m, f):
        out.append("F")
    elif 80 <= m + f:
        out.append("A")
    elif 65 <= m + f < 80:
        out.append("B")
    elif 50 <= m + f < 65:
        out.append("C")
    elif 30 <= m + f < 50:
        out.append("C" if 50 <= r else "D")
    else:
        out.append("F")

print(*out, sep="\n")

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=input().split()
    m,f,r=[int(m),int(f),int(r)]
    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:
        if R >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

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

Solution (Python):
score = []

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