import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List

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

main = do
    --d <- fmap (map judge . takeWhile (all (==(-1))) . map (map read . words) . lines) $ getContents 
    d <- map judge . takeWhile (any (/=(-1))) . map (map read . words) . lines <$> getContents 
    mapM_ putStrLn d