N = int(input()) ONE = (1000 / 12) ok, ng = 0, 0 for _ in range(N): l = input().split() ct = int(l[0]) // ONE if ct >= len(str(l[1])): ok += len(str(l[1])) else: ok += ct ng += len(str(l[1])) - ct print('{0} {1}'.format(int(ok), int(ng)))