import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) n = int(readline()) ans = [0, 0] for i in range(n): t, s = input().split() memo = 12 * int(t) // 1000 ans[0] += min(len(list(s)), memo) ans[1] += max(len(list(s)) - memo, 0) print(*ans)