N = int(input()) ans1 = 0 ans2 = 0 for _ in range(N): t, s = input().split() t = int(t) x = min(12*t//1000, len(s)) ans1 += x ans2 += len(s)-x print(ans1, ans2)