N = int(input()) G,B = 0,0 for _ in range(N): T,S = input().split() g = min(len(S), int(int(T)*12/1000)) G += g B += len(S) - g print(G, B)