import Control.Applicative

type Data = (Int, Int, Int)

type Problem = [Data]

type Result = [String]

judge :: Data -> String

judge (m, f, r)
    | m == -1 || f == -1
        = "F"
        
    | m + f >= 80
        = "A"
        
    | m + f >= 65
        = "B"
        
    | m + f >= 50 || r >= 50
        = "C"
        
    | m + f >= 30
        = "D"
        
    | otherwise
        = "F"

solve :: Problem -> Result

solve xs
    = map judge xs

input :: IO Problem

input
    = return =<< inputProblem []
    
inputProblem :: Problem -> IO Problem

inputProblem xs
    = do
        [m, f, r] <- map read.words <$> getLine
        if (m, f, r) /= (-1, -1, -1)
            then inputProblem $ xs ++ [(m, f, r)]
            else return xs
            
output :: Result -> String

output xs
    = concat $ map (++ "\n") xs
    
main :: IO ()

main
    = putStr.output =<< solve <$> input