while gets
  m, f, r = $_.split.map(&:to_i)
  if m == -1 && f == -1 && r == -1
    break
  end

  rank = nil
  if m == -1 || f == -1
    rank = "F"
  elsif m+f >= 80
    rank = "A"
  elsif m+f >= 65
    rank = "B"
  elsif m+f >= 50 || (m+f >= 30 && r >= 50)
    rank = "C"
  elsif m+f >= 30
    rank = "D"
  else
    rank = "F"
  end

  puts rank
end

