class A def initialize n = gets.chomp.to_i clear = 0 faild = 0 n.times do a, b = gets.chomp.split(' ') count = [((12 * a.to_i)/1000.0).floor, b.size].min clear += count faild += b.size - count end puts [clear, faild].join(' ') end end A.new