import Control.Applicative

main = do xs <- map (map read . words) . lines <$> getContents
          putStr . unlines . filter (/="") $ map solve xs

solve :: [Int] -> String
solve (m:f:r:_) | m == -1 && f == -1 && r == -1 = ""
                | m== -1 || f== -1 = "F"
                | m+f>=80 = "A"
                | m+f>=65 = "B"
                | m+f>=50 || (m+f>=30 && r>=50) = "C"
                | m+f>=30 = "D"
                | otherwise = "F"