N = int(input()) a1, a2 = 0, 0 for i in range(N): T, S = input().split() T = int(T) M = len(S) ok = min(M, (T * 12) // 1000) a1 += ok a2 += (M - ok) print(a1, a2)