import Data.Functor( (<$>))

main = do
    ls <- takeWhile ("-1 -1 -1"/=) . lines <$> getContents
    let
	records = (read <$>) <$> words <$> ls

	eval [m,f,r]
	    | m == -1 || f == -1    = 'F'
	    |	80 <= m+f	    = 'A'
	    |	65 <= m+f	    = 'B'
	    |	50 <= m+f	    = 'C'
	    |	30 <= m+f	    = if 50<=r then 'C' else 'D'
	    |	otherwise	    = 'F'

	putCharLn rec = putStrLn [eval rec]

    putCharLn `mapM_` records
    

