let () =
  let rec loop () =
    let a = Scanf.scanf "%d %d %d\n" (fun x y z -> x, y, z) in
    match a with
      | -1, -1, -1 -> []
      | -1, _, _ | _, -1, _ -> 'F' :: loop ()
      | m, f, r -> if m + f >= 80 then 'A' :: loop ()
                   else if m + f >= 65 then 'B' :: loop ()
                   else if m + f >= 50 then 'C' :: loop ()
                   else if m + f < 30 then 'F' :: loop ()
                   else if r >= 50 then 'C' :: loop ()
                   else 'D' :: loop ()
    in
  loop ()
    |> List.map (String.make 1)
    |> String.concat "\n"
    |> Printf.printf "%s\n"