n=int(input()) c=s=0 for i in range(n): a,b=input().split() s+=len(b) c+=min(int(int(a)/1000*12),len(b)) print(c,s-c)