G,B=0,0 for _ in '1'*int(input()):T,S=input().split();s=len(S);g=min(s,int(int(T)*6/500));G+=g;B+=s-g print(G,B)