module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO ()
loop = do
  { [m, f, r] <- getInts
  ; if m == -1 &&  f == -1 && r == -1 then return()
    else if m == -1 || f == -1 then putStrLn "F" >> loop 
    else if m + f >= 80 then putStrLn "A" >> loop
    else if m + f >= 65 then putStrLn "B" >> loop
    else if m + f >= 50 then putStrLn "C" >> loop
    else if m + f >= 30 then putStrLn (if r >= 50 then "C" else "D" ) >>loop
    else putStrLn "F" >> loop
  }

--
getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDoubles

showDoubles :: Double -> String
showDoubles d = showFFloat Nothing d ""



