n=int(input()) f=lambda x:(12*int(x))//1000 c,d=0,0 for _ in range(n): a,b=input().split() c+=min(f(a),len(b)) d+=len(b) print(c,d-c)