import Control.Monad
import Control.Applicative

rate (-1) _ _ = "F"
rate _ (-1) _ = "F"
rate 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"

processInputLine [m,f,r] =
    if m == -1 && f == -1 && r == -1 then return () else putStrLn $ rate m f r

main = do
    mapM_ processInputLine =<< map (map (read :: String->Int) . words) <$> lines <$> getContents