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

a = sys.stdin.readlines()
for i in range(len(a)):
	b = a[i].split()
	m =int(b[0])
	f =int(b[1])
	r =int(b[2])
	if m*f < 0 :
		print "F"
	elif m==-1 and f==-1 and r==-1:
		break
	else:
		if m+f >= 80:
			print "A"
		elif 80 > m+f >=65:
			print "B"
		elif 65 > m+f >=50:
			print "C"
		elif 50 > m+f >=30 and r < 50:
			print "D"
		elif 50 > m+f >=30 and r >= 50:	
			print "C"
		elif 30 > m+f:
			print "F"

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

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

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

for i in A:
	print(i)

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

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

Solution (Python):
for m, f, r in ((int(j) for j in i.split()) for i in iter(input, "-1 -1 -1")):
  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):
student_info = []
while True:
    s = map(int,raw_input().split(" "))

    if s[0] is s[1] is s[2] is -1:
        break
    
    student_info.append(s)

score_info = []
for s in student_info:
    if s[0] == -1 or s[1] == -1:
        score_info.append("F")

    elif s[0]+s[1] >= 80:
        score_info.append("A")

    elif 65 <= s[0]+s[1] < 80:
        score_info.append("B")

    elif 50 <= s[0]+s[1] < 65:
        score_info.append("C")

    elif 30<= s[0]+s[1] < 50:
        if s[2] >= 50:
            score_info.append("C")
        else:
            score_info.append("D")
    else:
        score_info.append("F")

for i in score_info:
    print i

Solution (Python):


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

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

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

Solution (Python):

x = raw_input()
m, f, r = x.split()
m = int(m)
f = int(f)
r = int(r)

while m != -1 or f != -1 or r != -1:
    sum = m + f
    if (m == -1 or f == -1) or sum < 30:
        print "F"
    elif sum >= 80:
        print "A"
    elif 80 > sum and sum >= 65:
        print "B"
    elif 65 > sum and sum >= 50:
        print "C"
    elif 50 > sum and sum >= 30:
        if r < 50:
            print "D"
        else:
            print "C"
            
    x = raw_input()
    m, f, r = x.split()
    m = int(m)
    f = int(f)
    r = int(r)

Solution (Python):
while True:
    inter_test,end_test,re_test = map(int,raw_input().split())

    if [inter_test,end_test,re_test] == [-1,-1,-1]:
        break
    if inter_test == -1 or end_test == -1 :
        print 'F'
    elif inter_test+end_test >= 80 :
        print 'A'
    elif inter_test+end_test >= 65 :
        print 'B'
    elif inter_test+end_test >= 50 :
        print 'C'
    elif inter_test+end_test >= 30 :
        if re_test >= 50 :
            print 'C'
        else :
            print 'D'
    else :
        print 'F'

Solution (Python):
while True:
    i,e,r = map(int,raw_input().split())

    if i == e == r == -1:
        break
    if i == -1 or e == -1 :
        print 'F'
    elif i+e >= 80 :
        print 'A'
    elif i+e >= 65 :
        print 'B'
    elif i+e >= 50 :
        print 'C'
    elif i+e >= 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
    score = m + f

    if(m==-1 or f==-1): print('F')
    elif(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')

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

while m != -1 or f != -1 or r != -1:

	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"

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

Solution (Python):


n = 0
while n == 0:
    m = map(int,raw_input().split())
    if m[0] + m[1] + m[2] == -3:
        break
    if m[0] == -1 or m[1] == -1:
        print "F"
    else:
        for i in xrange(2):
            if m[i] == -1:
                m[i] = 0
        k = m[0] + m[1]
        if k >= 80:
            print "A"
        elif k >= 65:
            print "B"
        elif k >= 50:
            print "C"
        elif k >= 30:
            if m[2] >= 50:
                print "C"
            else:
                print "D"
        elif k < 30:
            print "F"

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

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

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

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

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

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

Solution (Python):
import sys
import math

while 1:
    m, f, r = map(int, raw_input().split())

    if m + f + r == -3 :
        break

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

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

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

Solution (Python):
while(True):
	score = [int(i) for i in input().split()]
	if score[:] == [-1,-1,-1]:
		break
	if score[0] == -1 or score[1] == -1:
		print('F')
	else:
		score_sum = score[0] + score[1]
		if score_sum >= 80:
			print('A')
		elif 80 > score_sum >= 65:
			print('B')
		elif 65 > score_sum >= 50:
			print('C')
		elif 50 > score_sum >= 30:
			if score[2] >= 50:
				print('C')
			else :
				print('D')
		elif 30 > score_sum:
			print('F')

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

Solution (Python):

while True:
    m,f,r = [int(i) for i in 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")
        elif m + f >= 30 and m + f < 50:
            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):

if __name__ == "__main__":
	while True:
		score = [int(i) for i in input().split()]
		if score[0] == score[1] == score[2] == -1:
			break
		if score[0] == -1 or score[1] == -1:
			print ('F')
		else:
			if score[0] + score[1] >= 80:
				print ('A')
			elif score[0] + score[1] >= 65:
				print ('B')
			elif score[0] + score[1] >= 50:
				print ('C')
			elif score[0] + score[1] >= 30:
				if score[2] == -1:
					print ('D')
				else:
					if score[2] >= 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 == f == r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif 80 <= total:
        print("A")
    elif 65 <= total:
        print("B")
    elif 50 <= total:
        print("C")
    elif 30 <= total:
        if 50 <= r:
            print("C")
            continue
        print("D")
    else:
        print("F")

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

Solution (Python):
while True:

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

    print("{}".format(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 (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")
    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")
	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):
result = []
m,f,r=[int(x) for x in input().split()]
while not m==f==r==-1:
    if (m == -1 or f == -1):
        res = "F"
    elif (m + f >= 80):
        res = "A"
    elif (65 <= m + f < 80):
        res = "B"
    elif (50 <= m + f < 65):
        res = "C"
    elif (30 <= m + f < 50):
        res = "D"
        if (50 <= r):
            res = "C"
    else :
        res = "F"
    result.append(res)
    m,f,r=[int(x) for x in input().split()]
for i in result:
    print(i)

Solution (Python):
def judgetest(a, b, c):
    if a == -1 or b == -1:
        return 'F'
    sum = a + b
    if sum >= 80:
        return 'A'
    elif sum >= 65:
        return 'B'
    elif sum >= 50:
        return 'C'
    elif sum >= 30:
        if c >= 50:
            return 'C'
        else:
            return 'D'
    else:
        return 'F'

list = []
while True:
    a, b, c = map(int, input().split())
    if a == b == c == -1:
        break
    list.append(judgetest(a, b, c))

for s in list:
    print(s)

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

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

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

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

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

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')

    elif total < 80:
        print('B')
        
    else:
        print('A')

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

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

Solution (Python):
while True:
   m, f, r = [int(i) for i in input().split()]
 
   if m == f == r == -1:
      break
   total = m + f
   if m == -1 or f == -1 or total < 30:
      print("F")
   
   elif total < 50 and r < 50:
      print("D")

   elif r >= 50 or total < 65:
      print("C")
   
   elif total < 80:
      print("B")

   else:
      print("A")

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')
        
    else:
        print('A')

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

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65 or r >= 50:
        print('C')
        
    elif total < 80:
        print('B')

    else:
        print('A')

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')

    elif total < 80:
        print('B')

    else:
        print('A')

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

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')

    else:
        print('A')

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

Solution (Python):
while True:
    m, f, r = [int(i) for i in input().split()]

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

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')

    else:
        print('A')

Solution (Python):
while True:
   m, f, r = [int(i) for i in input().split()]
 
   if m == f == r == -1:
      break
   total = m + f
   if m == -1 or f == -1 or total < 30:
      print("F")
   
   elif total < 50 and r < 50:
      print("D")

   elif r >= 50 or total < 65:
      print("C")
   
   elif total < 80:
      print("B")

   else:
      print("A")

Solution (Python):


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

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

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

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

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

Solution (Python):
import sys

for i in sys.stdin.readlines():
    m, f, r = [int(x) for x in i.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 m + f >= 65:
        print('B')
    elif m + f >= 50 or (30 <= m + f <= 50 and r >= 50):
        print('C')
    elif m + f >= 30:
        print('D')

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

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

Solution (Python):
while True:
    L = raw_input().split()
    m = int(L[0])
    f = int(L[1])
    r = int(L[2])
    if m == -1 and f == -1 and r == -1: break
    x = m + f

    if m == -1 or f == -1 or x < 30: print "F"
    
    elif x < 50:
        if r < 50: print "D"
        else: print "C"
        
    elif x < 65: print "C"

    elif x < 80: print "B"

    else: print "A"

Solution (Python):
MFR = input().split()
m = int(MFR[0])
f = int(MFR[1])
r = int(MFR[2])

while m!=-1 or f!=-1 or r!=-1:
    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")
    MFR = input().split()
    m = int(MFR[0])
    f = int(MFR[1])
    r = int(MFR[2])

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

Solution (Python):


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

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

Solution (Python):

import sys

def main():
    while True:
        m, f, r = [int(i) for i in sys.stdin.readline().strip().split(' ')]
        if m == -1 and f == -1 and r == -1:
            break

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

        print(rank)

if __name__ == '__main__':
    main()

Solution (Python):
a = []
while True:
    d = list(map(int,input().split()))
    if d == [-1,-1,-1]:
        break
    a.append(d)

def Point2Grade(d):
    m,f,r = d
    if (m==-1)|(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'

for x in a:
    print(Point2Grade(x))