Problem:
Grading Write a program which reads a list of student test scores and evaluates the performance for each student. The test scores for a student include scores of the midterm examination m (out of 50), the final examination f (out of 50) and the makeup examination r (out of 100). If the student does not take the examination, the score is indicated by -1. The final performance of a student is evaluated by the following procedure:  If the student does not take the midterm or final examination, the student's grade shall be F.  If the total score of the midterm and final examination is greater than or equal to 80, the student's grade shall be A.  If the total score of the midterm and final examination is greater than or equal to 65 and less than 80, the student's grade shall be B.  If the total score of the midterm and final examination is greater than or equal to 50 and less than 65, the student's grade shall be C.  If the total score of the midterm and final examination is greater than or equal to 30 and less than 50, the student's grade shall be D. However, if the score of the makeup examination is greater than or equal to 50, the grade shall be C.  If the total score of the midterm and final examination is less than 30, the student's grade shall be F.  Input The input consists of multiple datasets. For each dataset, three integers m , f and r are given in a line. The input ends with three -1 for m , f and r respectively. Your program should not process for the terminal symbols. The number of datasets (the number of students) does not exceed 50. Output For each dataset, print the grade ( A , B , C , D or F ) in a line. Sample Input 40 42 -1
20 30 -1
0 2 -1
-1 -1 -1 Sample Output A
C
F

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

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

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

Solution (Python):
import sys

l = []
for i in sys.stdin:
    l.append(i.split())

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

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

Solution (Python):
m = []
f = []
r = []
while(1):
    a,b,c = map(int,raw_input().split())
    if a == -1 and b == -1 and c == -1:
        break
    else:
        m.append(a)
        f.append(b)
        r.append(c)

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

Solution (Python):
while True:
    m,f,r = tuple(int(n) for n in 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 65 <= m + f < 80:
        print("B")
    elif 50 <= m + f < 65:
        print("C")
    else:
        if r >= 50:
            print("C")
        else:
            print("D")

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

Solution (Python):
while True:
    m,f,r = map(int, input().split())
    if (m,f,r) == (-1,-1,-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:
    中間, 期末, 再試験 = map(int, input().split())
    if 中間 < 0 and 期末 < 0 and 再試験 < 0:
        break
    合計点 = 中間 + 期末

    if 中間 < 0 or 期末 < 0:
        print("F")    
    elif 合計点 >= 80:
        print("A")
    elif 65 <= 合計点 and 合計点 < 80:
        print("B")
    elif 50 <= 合計点 and 合計点 < 65:
        print("C")
    elif 30 <= 合計点 and 合計点 < 50:
        if 再試験 >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

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

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

Solution (Python):



for i in range(50):
    m, f, r = [int(x) for x in input().split(' ')]
    if m == -1 and f == -1 and r == -1: break

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

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

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

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

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

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

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

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

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

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

m=0
while m<i:
    print(Ans[m])
    m=m+1

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, raw_input().split())
    s = m + f
    if m == -1 and f == -1 and r == -1: break
    elif m == -1 or f == -1 or s < 30: g=5
    elif 30 <= s and s < 50:
        if r >= 50: g=2
        else: g=3
    elif 50 <= s and s < 65: g=2
    elif 65 <= s and s < 80: g=1
    else: g=0
    print 'ABCDEF'[g]

Solution (Python):
while True:
    m, f, r  = [int(_) for _ in input().split()]
    if m == f == r == -1:
        break

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

Solution (Python):
result = []
while True:
    info = [int(n) for n in input().split()]
    if info[0]==info[1]==info[2]==-1:
        break
    elif -1 in info[:2]:
        result.append("F")
    elif info[0] + info[1] >= 80:
        result.append("A")
    elif 65 <= info[0] + info[1] < 80:
        result.append("B")
    elif 50 <= info[0] + info[1] < 65:
        result.append("C")
    elif 30 <= info[0] + info[1] < 50 and info[2] >= 50:
        result.append("C")
    elif 30 <= info[0] + info[1] < 50:
        result.append("D")
    else:
        result.append("F")
for i in result:
    print(i)

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


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

    print(judge())

Solution (Python):


def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    while True:
        data = numinput()
        if data[0] < 0 and data[1] < 0 and data[2] < 0: break
        grade = ""
        if data[0] + data[1] >= 80: grade = "A"
        elif data[0] + data[1] >= 65: grade = "B"
        elif data[0] + data[1] >= 50: grade = "C"
        elif data[0] + data[1] >= 30:
            if data[2] >= 50: grade = "C"
            else: grade = "D"
        else:
            grade = "F"
        if data[0] < 0 or data[1] < 0: grade = "F"
        print(grade)

if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
def judge():
    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")

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

Solution (Python):

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

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

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

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

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

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

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

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

Solution (Python):


end = 0
while end == 0:
    test = [int(i) for i in input().rstrip().split()]
    midterm = test[0]
    final = test[1]
    makeup = test[2]
    if midterm == -1 and final == -1 and makeup == -1:
        end += 1
    elif midterm == -1 or final == -1:
        print('F')
    else:
        if midterm + final >= 80:
            print('A')
        elif midterm + final >= 65:
            print('B')
        elif midterm + final >= 50:
            print('C')
        elif midterm + final >= 30:
            if makeup >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')

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

Solution (Python):
import sys

i = 0
for line in sys.stdin:
    m,f,r = line.split()
    m,f,r = int(m),int(f),int(r)

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

Solution (Python):
while True:
    m,f,r = map(int, raw_input().split())
    s = m + f
    if m == -1 and f == -1 and r == -1: break
    elif m == -1 or f == -1 or s < 30: g=5
    elif 30 <= s and s < 50:
        if r >= 50: g=2
        else: g=3
    elif 50 <= s and s < 65: g=2
    elif 65 <= s and s < 80: g=1
    else: g=0
    print 'ABCDEF'[g]

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

Solution (Python):
from __future__ import division, print_function
from sys import stdin
while True:
    m, f, r = (int(s) for s in stdin.readline().split())
    if m < 0 and f < 0 and r < 0:
        break
    mf = m + f
    if m < 0 or f < 0 or mf < 30:
        print('F')
    elif mf >= 80:
        print('A')
    elif mf >= 65:
        print('B')
    elif mf >= 50 or r >= 50:
        print('C')
    else:
        print('D')

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

Solution (Python):
while True:
	a, b, c = map(int, raw_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:
		print "F"
	elif c >= 50:
		print "C"
	else:
		print "D"

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

Solution (Python):
while True:
    m, f, r = map(int, 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:
	m, f, r = map(int, raw_input().split())
	if m + f + r == -3: break

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

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

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

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

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

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

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

Solution (Python):
while True :

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

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

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

Solution (Python):
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 or c>=50:
        print("C")
    elif a+b>=30:
        if c>=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")
    else:
        s=m+f
        if s>=80:
            print("A")
        if 65<=s<80:
            print("B")
        if 50<=s<65:
            print("C")
        if 30<=s<50:
            if r>=50:
                print("C")
            else:
                print("D")
        if s<30:
            print("F")

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

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

Solution (Python):
while True:
    x = []
    x = input().split( )
    y = [int(s) for s in x]
    if sum(y) == -3:
        break
    if y[0] == -1 or y[1] == -1:
        print("F")
    elif y[0] + y[1] < 30:
        print("F")
    elif y[0] + y[1] >= 30 and y[0] + y[1] <50:
        if y[2] >= 50:
            print("C")
        else:
            print("D")
    elif  y[0] + y[1] >= 50 and y[0] + y[1] <65:
        print("C")
    elif  y[0] + y[1] >= 65 and y[0] + y[1] <80:
        print("B")
    elif  y[0] + y[1] >= 80:
        print("A")

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

Solution (Python):
import math
while True:
    a,b,c=map(float,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 80>(a+b) and (a+b)>=65:
        print("B")
    elif 65>(a+b) and (a+b)>=50:
        print("C")
    elif c>=50:print("C")
    elif 50>(a+b) and (a+b)>=30:
        print("D")
    elif 30>(a+b):
        print("F")

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

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

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