let () =
  let buf = Buffer.create 128 in
  let rec loop () =
    let p,r = Scanf.sscanf (read_line ()) "%d %d %d" (fun m f r -> m+f,r) in
    if (p,r) = (-2,-1) then print_string (Buffer.contents buf)
    else
      (Buffer.add_string buf
         (if p >= 80 then "A"^"\n"
          else if p >= 65 then "B"^"\n"
          else if p >= 50 then "C"^"\n"
          else if p >= 30 then (if r >= 50 then "C" else "D")^"\n"
          else "F"^"\n");
       loop ())
  in
  loop ()