N = int(input()) correct = 0 total = 0 for _ in range(N): T,S = map(str,input().split()) T = int(T) correct += min(T*12//1000,len(S)) total += len(S) print(correct, total-correct)