import Control.Applicative import Control.Monad import Data.List (foldl') import Text.Printf main = do n <- readLn ts <- replicateM n $ words <$> getLine let f (t:s:_) = (s'-missed, missed) where t' = read t s' = length s missed = max (s'-12*t'`div`1000) 0 (a, b) = foldl' (\(a,b) (c,d) -> (a+c,b+d)) (0, 0) $ map f ts in printf "%d %d\n" a b