import Control.Applicative
import qualified Control.Monad as Monad (when)

main = loopGrading

loopGrading :: IO ()
loopGrading = do
    result <- map (read :: String -> Int) . words <$> getLine
    Monad.when (any (/= (-1)) result) $ do
        putStrLn $ grading result
        loopGrading

grading :: [Int] -> String
grading [m,f,r]
    | m == (-1) || f == (-1) = "F"
    | total >= 80            = "A"
    | total >= 65            = "B"
    | total >= 50 || r >= 50 = "C"
    | total >= 30            = "D"
    | otherwise              = "F"
    where total = m + f