import Control.Monad

grade m f r
  | m == -1 || f == -1 = "F"
  | m + f >= 80 = "A"
  | m + f >= 65 = "B"
  | m + f >= 50 = "C"
  | m + f >= 30 = if r >= 50 then "C" else "D"
  | otherwise = "F"

toIntList list = map (\x -> read x :: Int) . words $ list

main = do
  a <- return . lines =<< getContents
  mapM_ putStrLn $ map (\[m, f, r] -> grade m f r) $ map toIntList a