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):
def grade(m, f, r):
    if m == -1 or f == -1:
        return 'F'

    if 80 <= m+f:
        return 'A'

    if 65 <= m+f:
        return 'B'

    if 50 <= m+f:
        return 'C'

    if 30 <= m+f:
        return 'C' if 50 <= r else 'D'

    return 'F'

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

        print(grade(m,f,r))

if __name__ == '__main__':
    main()

Solution (Python):
def main():

    while True:
        m, f, r = tuple(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')

if __name__ == '__main__':
    main()

Solution (Python):
def main():

    while True:
        m, f, r = tuple(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')

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    while True:
        m, f, r = map(int, input().split())
        if m == f == 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')
    return


if __name__ == '__main__':
    main()

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

Solution (Python):
flag = 1
all_tes_date = []
jag = []
while flag:
    tes_date = [int(tes) for tes in input().split()]
    if tes_date == [-1,-1,-1]:
        flag = 0
    else:
        all_tes_date.append(tes_date)

for tes_jag in all_tes_date:
    if (tes_jag[0] + tes_jag[1]) > 79:
        jag.append('A')
    elif (tes_jag[0] + tes_jag[1]) > 64:
        jag.append('B')
    elif ((tes_jag[0] + tes_jag[1]) > 49):
        jag.append('C')
    elif (tes_jag[0] + tes_jag[1]) > 29 and not(tes_jag[0] == -1) and not(tes_jag[1] == -1):
        if tes_jag[2] > 49:
            jag.append('C')
        else:
            jag.append('D')
    elif ((tes_jag[0] + tes_jag[1]) < 30) or (tes_jag[0] == -1) or (tes_jag[1] == -1):
        jag.append('F')
        
for jag_rs in jag:
    print(jag_rs)

Solution (Python):
one = [int(i) for i in input().split()]
data = []
while one != [-1, -1, -1]:
    data.append(one)
    one = [int(i) for i in input().split()]

answer = ['F' if i[0] == -1 or i[1] == -1 else 'A' if i[0] + i[1] >= 80 else 'B' if 65 <= i[0] + i[1] < 80 else 'C' if 50 <= i[0] + i[1] < 65 else 'C' if 30 <= i[0] + i[1] < 50 and 50 <= i[2] else 'D' if 30 <= i[0] + i[1] < 50 else 'F' for i in data]
print(*answer, sep="\n")

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

Solution (Python):
b = []

while True:
    inp = input()
    a = inp.split()
    a[0] = int(a[0])
    a[1] = int(a[1])
    a[2] = int(a[2])
    if a[0] == -1 and a[1] == -1 and a[2] == -1:
        break
    else:
        b.append(a)

for i in b:
    if i[0] == -1 or i[1] == -1:
        print("F")
    elif i[0]+i[1] >= 80:
        print("A")
    elif i[0]+i[1] >= 65:
        print("B")
    elif i[0]+i[1] >= 50:
        print("C")
    elif i[0]+i[1] < 30:
        print("F")
    elif i[2] >= 50:
        print("C")
    else:
        print("D")

Solution (Python):


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

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

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

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

Solution (Python):
from sys import maxsize

def calc(m, f, r):
    border = [80, 65, 50, 30]
    grade = ["A", "B", "C", "D", "F"]

    if min(m, f) == -1:
        return grade[-1]
    if r >= 50:
        border[grade.index("C")] = -1 * maxsize

    i = 0
    while i < len(border) and m + f < border[i]:
        i += 1

    return grade[i]

ans = []
while True:
    m, f, r = map(int, input().split())
    if max(m, f, r) == -1:
        break
    ans.append(calc(m, f, r))

print("\n".join(ans))

Solution (Python):
while True:
    m, f, r = map(int, input().split())
    score = ""
    if all([x < 0 for x in [m, f, r]]):
        break
    if any([x < 0 for x in [m, f]]):
        score = "F"
    elif 80 <= m+f:
        score = "A"
    elif 65 <= m+f:
        score = "B"
    elif 50 <= m+f or (30 <= m+f and 50 <= r):
        score = "C"
    elif 30 <= m+f:
        score = "D"
    else:
        score = "F"
    print(score)

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

for result in results:
    print(result)

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

for result in results:
    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):
marks=[]
while True:
    s=input().split()
    marks.append(s)
    if ["-1","-1","-1"] in marks:
        break
marks=marks[:-1]
for i in marks:
    if int(i[0])==-1 or int(i[1])==-1:
        print("F")
    elif int(i[0])+int(i[1])>=80:
        print("A")
    elif 65<=int(i[0])+int(i[1])<80:
        print("B")
    elif 50<=int(i[0])+int(i[1])<65:
        print("C")
    elif 30<=int(i[0])+int(i[1])<50:
        if int(i[2])>=50:
            print("C")
        else:
            print("D")
    elif int(i[0])+int(i[1])<30:
        print("F")

Solution (Python):
readline = open(0).readline
ans = []
while 1:
    m, f, r = map(int, readline().split())
    if m == f == r == -1:
        break
    v = m+f
    if m == -1 or f == -1 or v < 30:
        ans.append("F\n")
    elif v >= 80:
        ans.append("A\n")
    elif v >= 65:
        ans.append("B\n")
    elif v >= 50 or (v >= 30 and r >= 50):
        ans.append("C\n")
    else:
        ans.append("D\n")
open(1, 'w').writelines(ans)

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

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

Solution (Python):
from sys import stdin

def score(mid, fin, re):
    if mid == -1 or fin == -1:
        return "F"
    elif (mid+fin) >= 80:
        return "A"
    elif (mid+fin) >= 65:
        return "B"
    elif (mid+fin) >= 50:
        return "C"
    elif (mid+fin) >= 30:
        if re >= 50:
            return "C"
        else:
            return "D"
    else:
        return "F"

while True:
    m, f, r = [int(x) for x in stdin.readline().rstrip().split()]
    if m == -1 and f == -1 and r == -1:
        break
    else:
        print(score(m, f, r))

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

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

Solution (Python):
score = []


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










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

Solution (Python):
score = []


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










for i in range(len(score)):
    sum = score[i][0] + score[i][1]
    if score[i][0] == -1 or score[i][1] == -1 or sum < 30:
        print('F')
    elif sum >= 80:
        print('A')
    elif sum >= 65:
        print('B')
    elif sum >= 50:
        print('C')
    elif sum >= 30:
        if score[i][2] >= 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 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):
midScore =[0]*50
finScore = [0]*50
reScore = [0]*50
personNum = 0
while True:
    m,f,r = map(int,input().split())
    midScore[personNum] = m
    finScore[personNum] = f
    reScore[personNum] = r
    personNum += 1
    if m is f is r is -1:
        break
    
    
for person in range(personNum):
    totalScore = midScore[person] + finScore[person]
    if midScore[person] is finScore[person] is reScore[person] is -1:
        pass
    elif midScore[person] == -1 or finScore[person] == -1:
        print("F")
    elif 80<=totalScore:
        print("A")
    elif 65<=totalScore<80:
        print("B")
    elif 50<=totalScore<65:
        print("C")
    elif 30<=totalScore<50:
        if 50<=reScore[person]:
            print("C")
        else:
            print("D")
    elif totalScore<30:
        print("F")

Solution (Python):
while(1):
    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 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+f+r==-3: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 and r>=50:s="C"
    elif m+f>=30:s="D"
    else:s="F"
    print(str(s))

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

Solution (Python):


while True:
    N = list(map(int, input().split()))

    total_score = N[0] + N[1]
    
    if N[0] == -1 and N[1] == -1 and N[2] == -1:
        break
    if N[0] == -1 or N[1] == -1:
        print('F')
    elif total_score >= 80:
        print('A')
    elif 80 > total_score >= 65:
        print('B')
    elif 65 > total_score >= 50:
        print('C')
    elif 50 > total_score >= 30:
        if N[2] >= 50:
            print('C')
        elif 50 > N[2]:
            print('D')
    elif 30 > total_score:
        print('F')

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

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

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

Solution (Python):
m,f,r = 0,0,0
table = []
i = 0

while m != -1 or f != -1 or r != -1:
  m,f,r = (int(x) for x in input().split())
  table.append([m,f,r])

for p in table:
  m,f,r = p[0],p[1],p[2]
  if m == -1 and f == -1 and r == -1:
    break
  if m == -1 or f == -1:
    print('F')
  elif m + f >= 80:
    print('A') 
  elif m + f >= 65:
    print('B')
  elif m + f >= 50:
    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 >= 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 1:
    a, b, c = map(int, input().split())
    if a == b == c == -1:
        break
    if a == -1 or b == -1 or a + b < 30:print('F')
    elif a + b >= 80:print('A')
    elif a + b >= 65: print('B')
    elif a + b >= 50:print('C')
    elif a + b >= 30 and c >= 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
    elif (m == -1 or f == -1) or m+f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        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 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):
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
while True:
    M,F,R = map(int,input().split())
    if M == -1 and F == -1 and R == -1:
        break
    if M == -1 or F == -1:
        print("F")
    elif M+F >= 80:
        print("A")
    elif M+F >= 65:
        print("B")
    elif M+F >= 50:
        print("C")
    elif M+F >= 30:
        if R >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Solution (Python):
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 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 == -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 r >= 50:
      print("C")
    elif 30 <= m + f < 50:
      print("D")
    elif r >= 50:
      print("C")
    else :
      print("F")

Solution (Python):
if __name__ == '__main__':
    from sys import stdin

    while True:
        m, f, r = (int(n) for n in stdin.readline().rstrip().split())

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

        s = m + f
        result = "F" if m == -1 or f == -1 \
            else "A" if 80 <= s \
            else "B" if 65 <= s \
            else "C" if 50 <= s or 50 <= r \
            else "D" if 30 <= s \
            else "F"

        print(result)

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

Solution (Python):
m=[0]*50
f=[0]*50
r=[0]*50
result=[""]*50

num=0
while True:
  a,b,c=map(int,input().split())
  if a == b == c ==-1:
    break
  else:
    m[num],f[num],r[num]=a,b,c
  num+=1

for i in range(num):
  if m[i] == -1 or f[i]==-1:
    result[i]="F"
  elif m[i]+f[i]>=80:
    result[i]="A"
  elif m[i]+f[i]>=65:
    result[i]="B"
  elif m[i]+f[i]>=50:
    result[i]="C"
  elif m[i]+f[i]>=30:
    if r[i] >=50:
      result[i]="C"
    else:
      result[i]="D"
  else:
    result[i]="F"

for i in range(num):
  print(result[i])

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

Solution (Python):
while True:
    m,f,r = [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):
S=[]
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:
    S.append('F')
  elif m+f>=80:
    S.append('A')
  elif 65<=m+f<80:
    S.append("B")
  elif 50<=m+f<65:
    S.append("C")
  else:
    if r>=50:
      S.append("C")
    else:
      S.append("D")
    
  k=int(0)  
for i in S:
  print(S[k])
  k=k+1

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

Solution (Python):
x = 0
m_list = []
f_list = []
r_list = []
while x < 50:
  m, f, r = map(int, input().split())
  if m == -1 and f == -1 and r == -1:
    break
  m_list.append(m)
  f_list.append(f)
  r_list.append(r)
  x = x+1
  
for(mlist,flist,rlist) in zip(m_list,f_list,r_list):
  if mlist == -1 or flist == -1:
    print("F")
  elif 80 <= mlist + flist:
    print("A")
  elif 65 <= mlist + flist and mlist + flist < 80:
    print("B")
  elif 50 <= mlist + flist and mlist + flist < 65:
    print("C")
  elif 30 <= mlist + flist and mlist + flist < 50:
    if 50 <= rlist:
      print("C")
    else:
      print("D")
  elif mlist + flist < 30:
    print("F")

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

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

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

Solution (Python):
st = list()
while True:
    a = list(map(lambda x: int(x),input().split(" ")))
    if min(a[0:2]) == -1:
        if max(a) == -1:
            break
        else:
            st += {"F"}
    else:
        if 80 <= sum(a[0:2]):
            st += {"A"}
        elif 65 <= sum(a[0:2]):
            st += {"B"}
        elif 50 <= sum(a[0:2]):
            st += {"C"}
        elif 30 <= sum(a[0:2]):
            if 50 <= a[2]:
                st += {"C"}
            else:
                st += {"D"}
        else:
            st += {"F"}
    
for s in st:
    print(s)

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

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