ok = 0 ng = 0 gets.to_i.times do t, s = gets.chomp.split(' ') t = t.to_i max = 12 * t / 1000 s = s.size o = [s, max].min ok += o ng += s - o end puts "#{ok} #{ng}"