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



Sample input:
40 42 -1
20 30 -1
0 2 -1
-1 -1 -1


Sample output:
A
C
F

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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:
            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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 中間試験、期末試験のいずれかを欠席した場合成績は F。
# 中間試験と期末試験の合計点数が 80 以上ならば成績は A 。
# 中間試験と期末試験の合計点数が 65 以上 80 未満ならば成績は B。
# 中間試験と期末試験の合計点数が 50 以上 65 未満ならば成績は C。
# 中間試験と期末試験の合計点数が 30 以上 50 未満ならば成績は D。 ただし、再試験の点数が 50 以上ならば成績は C。
# 中間試験と期末試験の合計点数が 30 未満ならば成績は F。

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m, f, r = map(int, input().split())
while m >= 0 or f >= 0 or r >= 0:
	if m < 0 or f < 0 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")
	m, f, r = map(int, input().split())

Submission status: Accepted

Solution code:
XS = list(map(int, open(0).read().split()))
for i in range(0, len(XS), 3):
    m, f, r = XS[i:i+3]
    if m == -1 and f == -1 and r == -1:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        exit()
    if m == -1 or f == -1:
        print('F')
        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')
    elif m + f < 30:
        print('F')

Submission status: Accepted

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

while True:
    if m == -1 and f == -1 and r == -1:
        break

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def is_a(m: int, f: int) -> bool:
    if 80 <= m + f:
        return True
    return False


def is_b(m: int, f: int) -> bool:
    if 65 <= m + f < 80:
        return True
    return False


def is_c(m: int, f: int, r: int) -> bool:
    if 50 <= r:
        return True
    if 50 <= m + f < 65:
        return True
    return False


def is_d(m: int, f: int, r: int) -> bool:
    if 30 <= m + f < 50:
        if 50 <= r:
            return False
        return True
    return False


def rank(m: int, f: int, r: int) -> str:
    if -1 in [m, f]:
        return 'F'

    if m < 0:
        m = 0
    if f < 0:
        f = 0
    if r < 0:
        r = 0

    if is_d(m, f, r):
        return 'D'
    if is_c(m, f, r):
        return 'C'
    if is_b(m, f):
        return 'B'
    if is_a(m, f):
        return 'A'
    return 'F'


def resolve():
    for line in sys.stdin:
        m, f, r = map(int, line.split())

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

        print(rank(m, f, r))


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    a,b,c=map(int,input().split())
    sum=0
    count=0
    if a==-1 and b==-1 and c==-1 :
        break
    elif a==-1 or b==-1:
        sum+=0
    else:
        sum+=a+b
    if 0<=sum<=29:
        print("F")
    elif 30<=sum<=49:
        if c>=50:
            print("C")
            count+=1
        else:
            print("D")
            
    elif 50<=sum<=64 and count==0:
        print("C")
    elif 65<=sum<=79:
        print("B")
    else:
        print("A")

Submission status: Accepted

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

    print(s)

Submission status: Accepted

Solution code:
while True:
    dataset = input().split(" ")
    m = int(dataset[0])
    f = int(dataset[1])
    r = int(dataset[2])

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

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

    print(grade)

Submission status: Accepted

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



for m,r,f in test:
  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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    while True:
        mid_score,final_score,makeup_score = map(int,input().split())
        if mid_score==-1 and final_score==-1 and makeup_score==-1:
            exit()
        if mid_score == -1 or final_score==-1:
            print("F")
        elif mid_score+final_score>=80:
            print("A")
        elif mid_score+final_score>=65 and mid_score+final_score<80:
            print("B")
        elif mid_score+final_score>=50 and mid_score+final_score<65:
            print("C")
        elif mid_score+final_score>=30 and mid_score+final_score<50:
            if makeup_score >= 50:
                print("C")
            else:
                print("D")
        elif mid_score+final_score<30:
            print("F")
        
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    m, f, r = [int(i) for i in input().strip().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")

Submission status: Accepted

Solution code:
while True:
    m, f, r = map(int, input().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 or (m+f>=30 and r>=50):
        print("C")
    elif m+f>= 30:
        print("D")

Submission status: Accepted

Solution code:
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 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')

Submission status: Accepted

Solution code:
while True:
    middle, final, retry = map(int, input().split())
    if middle == -1 and final == -1 and retry == -1:
        break
    if middle == -1 or final == -1:
        print("F")
    else:
        total = middle + final
        if total >= 80:
            print("A")
        elif 65 <= total < 80:
            print("B")
        elif 50 <= total < 65:
            print("C")
        elif 30 <= total < 50:
            print("D" if retry < 50 else "C")
        else:
            print("F")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
i = 0
n = 0
calc = 0

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

while i < n:
    calc = a[i][0] + a[i][1]

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

Submission status: Accepted

Solution code:
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 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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    if sum((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")

Submission status: Accepted

Solution code:
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 (M + F >= 30 and R >= 50):
        print('C')
    elif M + F >= 30:
        print('D')
    else:
        print('F')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
  m, f, r = list(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:
    print("C" if r >= 50 else "D")
  else:
    print("F")

Submission status: Accepted

Solution code:
while True:
    m, f, r = [int(line) for line in input().split()]
    if m == f == r == -1:
        break
    if -1 in (m, f):
        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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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 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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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