results = []

loop do
  m, f, r = gets.split.map(&:to_i)
  break if [m, f, r].all?(&:negative?)

  result = ''
  mf = m + f

  if [m, f].any?(&:negative?)
    result = 'F'
  elsif mf >= 80
    result = 'A'
  elsif mf >= 65
    result = 'B'
  elsif mf >= 50
    result = 'C'
  elsif mf >= 30
    result = 'D'
    result = 'C' if r >= 50
  else
    result = 'F'
  end

  results << result
end

results.each do |result|
  puts result
end

