while line = gets
  break if line == "-1 -1 -1"
  m,f,r = line.split(" ").map(&:to_i)
  puts if m + f >= 80
    "A"
  elsif m + f >= 65
    "B"
  elsif m + f >= 50 or m + f >= 30 and r >= 50 
    "C"
  elsif m + f >= 30
    "D"
  else
    "F"
  end
end