N=int(input()) T=[[i for i in input(). split ()] for i in range (N)] #rint (T) C=0 Cs=0 for i in range (N): T[i][0]=int(T[i][0]) C1=12*T[i][0]//1000 C+=C1 C2=len(T[i][1])-C1 if C2<0: C2=0 Cs+=C2 # print (Cs) R=Cs-C C=str(C) print (C+" "+R)