import Control.Monad
import Control.Applicative

data Grade = A | B | C | D | F deriving(Show)

solver :: Int -> Int -> Int -> Grade
solver m f r =
  let s = m + f
  in
    if m == -1 || f == -1
      then F
    else if s >= 80
      then A
    else if s >= 65
      then B
    else if s >= 50
      then C
    else if s >= 30
      then if r >= 50 then C else D
    else
      F

main :: IO()
main = do
  (m:f:r:_) <- map (read :: String -> Int) . words <$> getLine
  unless (m == -1 && f == -1 && r == -1) $ do
    print $ solver m f r
    main