grade t r
    | t >= 80 = "A"
    | t >= 65 = "B"
    | t >= 50 || r >= 50 = "C"
    | t >= 30 = "D"
    | otherwise = "F"

main = do
    str <- getLine
    let (m:f:r:_) = map read $ words str
    if ((m,f,r) == (-1,-1,-1)) then
        return ()
    else do
        putStrLn $ grade (m+f) r
        main