n=int(input()) nm=0 c=0 for i in range(n): m,s=input().split() m=int(m) t=len(s) q=m*12/1000 if t<=q: nm+=t else: nm+=int(q) c+=t-int(q) print(nm,c)