{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Unboxed
import Control.Applicative
import Text.Printf


readInt :: IO Int
readInt = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

main = f =<< replicateM 3 readInt

f [m,f,r]
  | m == -1 && f == -1 && r == -1 = return ()
  | m == -1 || f == -1 = p "F"
  | s >= 80 = p "A"
  | s >= 65 = p "B"
  | s >= 50 || r >= 50 = p "C"
  | s >= 30 = p "D"
  | otherwise = p "F"
  where
    s = m + f
    p t = putStrLn t >> main
