import Control.Applicative

func 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"

main = do
	l <- init . map(map(read::String->Int)) . map words . lines <$> getContents
	let l2 = [ func (t!!0) (t!!1) (t!!2) | t<-l ]
	mapM_ putStrLn $ l2