grade :: Int -> Int -> Int -> String
grade m f r
  | m == -1 || f == -1 = "F"
  | 80 <= t            = "A"
  | 65 <= t            = "B"
  | 50 <= t            = "C"
  | 30 <= t            = if 50 <= r then "C" else "D"
  | otherwise          = "F"
  where
    t = m + f

main :: IO ()
main = do
    [m, f, r] <- getLine >>= return.(map $ \n -> read n :: Int).words
    if m == -1 && f == -1 && r == -1 then
        return ()
    else
        (putStrLn $ grade m f r) >> main

