a,b = 0,0 gets.to_i.times do t,s = gets.split t = t.to_i a += [s.size, 12*t/1000].min b += s.size - [s.size, 12*t/1000].min end puts "#{a} #{b}"