let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let rec repl () =
  let l = read_line () in
  match List.map int_of_string (split l ' ') with
  | [] | [_] | _::_::[] -> exit 1
  | (-1) :: (-1) :: (-1) :: _ -> ()
  | m :: f :: r :: _ -> begin
      if m = (-1) || f = (-1) then Printf.printf "F\n"
      else begin
        let mf = m + f in
        if mf >= 80 then Printf.printf "A\n"
        else if mf >= 65 then Printf.printf "B\n"
        else if (mf >= 50) || (mf >= 30 && r >= 50) then Printf.printf "C\n"
        else if mf >= 30 then Printf.printf "D\n"
        else Printf.printf "F\n"
      end;
    repl ()
    end

let () =
  try repl () with End_of_file -> ()