solve1 [-1,_,_] = "F"
solve1 [_,-1,_] = "F"
solve1 [m,f,r]
  | 80 <= c = "A"
  | 65 <= c = "B"
  | 50 <= c = "C"
  | 30 <= c = if 50 <= r then "C" else "D"
  | otherwise = "F"
  where
    c  = m + f


main = do
  seiseki' <- getContents
  let seiseki = map (map read . words) . init $ lines seiseki'
  mapM_ putStrLn $ map solve1 seiseki
