grade :: Int -> Int -> Int -> String
grade (-1) _ _ = "F"
grade _ (-1) _ = "F"
grade m f r | m + f >= 80 = "A"
            | m + f >= 65 = "B"
            | m + f >= 50 = "C"
            | m + f >= 30 = if r > 50 then "C" else "D"
            | otherwise   = "F"

main :: IO ()
main = do
  [m, f, r] <- fmap (map read . words) getLine
  if m == -1 && f == -1 && r == -1
    then return ()
    else do
    putStrLn $ grade m f r
    main