import math pace = 1000/12 typed = 0 missed = 0 n = int(input()) for i in range(n): l,w = input().split() limit = int(l) if limit/pace >= len(w): typed += len(w) else: typed += math.floor(limit/pace) missed += len(w) - math.floor(limit/pace) print("{0} {1}".format(typed,missed))