import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  (n : m : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  pss <- sequence . replicate m $ ((,) <$> pred . unsafeSignedDecimal . fst <*> (== T.pack "AC") . snd) . unsafeListToTuple . T.words <$> T.getLine :: IO [(Int, Bool)]
  let
    as :: V.Vector (Bool, Int)
    as = V.accum op (V.replicate n (False, 0)) pss
    op :: (Bool, Int) -> Bool -> (Bool, Int)
    op (False, w) False = (False, succ w)
    op (False, w) True = (True, w)
    op x _ = x
    (a, w) = V.foldl step (0, 0) as
    step (s, t) (True, u) = (succ s, t + u)
    step x _ = x
  putStr . show $ a
  putStr " "
  putStrLn . show $ w

unsafeListToTuple :: [a] -> (a, a)
unsafeListToTuple (x : y : _) = (x, y)

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
