n = gets.to_i s,t = 0,0 n.times{ x,y = gets.split x = x.to_i*12/1000 y = y.size s += [x,y].min t += [y-x,0].max } puts [s,t]*" "