n = int(input()) W=L=0 for i in range(n): t, s = input().split() t = int(t) s = len(s) write = int(12*t/1000) if write >= 0 and s-write > 0: W+= write l = s - write else: W+= s l = 0 L+=l print(W, L)