main = do
  s <- getContents
  let l = takeWhile (\[x,y,z]->not (x== -1 && y== -1 && z== -1) )  $ (map (map (read::String->Int) . words) . lines) $ s
  mapM putStrLn $ map rst l

rst :: [Int] -> String
rst [m,f,r]
  | m == -1 || f == -1   = "F"
  | m + f >= 80          = "A"
  | m + f >= 65          = "B"
  | m + f >= 50          = "C"
  | m + f >= 30 && r>=50 = "C"
  | m + f >= 30          = "D"
  | otherwise            = "F"