c=m=0;exec("t,s=raw_input().split();l=len(s);p=int(t)*3/250;c+=min(l,p);m+=max(0,l-p);"*input());print c,m