N = int(input()) typed = 0 total = 0 for n in range(N): t, s = input().split() t = int(t) lens = len(s) typed += min(12 * t // 1000, lens) total += lens print(typed, total - typed)