#!/usr/bin/env python3 #fileencoding: utf-8 from math import floor N = int(input()) ok = 0 ng = 0 for i in range(N): T, S = input().strip().split(" ") typed = floor(12.0*int(T)/1000.0) if typed > len(S): ok += len(S) else: ok += typed ng += len(S) - typed print("%d %d"%(ok,ng))