N = input() c = m = 0 for i in xrange(N): t,s = raw_input().split() l = len(s) tp = int(t)*12/1000 c += min(l,tp) m += max(0,len(s)-tp) print c,m