let () =
  let m, f, r = ref 0, ref 0, ref 0 in
  while Scanf.scanf "%d %d %d\n" (fun x y z -> m := x; f:= y; r := z);
        not (!m = -1 && !f = - 1 && !r = -1) do
    let sum = !m + !f in 
    if (!m = -1 || !f = -1) then print_endline "F"
    else if sum >= 80 then print_endline "A"
    else if 65 <= sum && sum < 80 then print_endline "B"
    else if 50 <= sum && sum < 65 then print_endline "C"
    else if 30 <= sum && sum < 50 then (if !r < 50 then print_endline "D"
                                        else print_endline "C")
    else print_endline "F"
  done ;;
