let () =
  let buf = Buffer.create 128 in
  let rec loop () =
    let m,f,r = Scanf.sscanf (read_line ()) "%d %d %d" (fun m f r -> m,f,r) in
    let p = m+f 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 || m = -1 || f = -1 then "F"^"\n"
          else (if r >= 50 then "C" else "D")^"\n");
       loop ())
  in
  loop ()