import Control.Monad import Control.Applicative import Text.Printf main :: IO() main = do n <- readLn :: IO Int input <- replicateM n $ words <$> getLine let tmp = map numChars input let typed = map (\ (i, j) -> i) tmp let missed = map (\ (i, j) -> j) tmp printf "%d %d\n" (sum(typed) :: Int) (sum(missed) :: Int) numChars :: [String] -> (Int, Int) numChars args = let lim = 12 * t `div` 1000 in case lim > length(s) of True -> (length(s), 0) False -> (lim, length(s) - lim) where t = readInt $ args !! 0 s = args !! 1 readInt :: String -> Int readInt = read