test_case = gets.chomp.to_i sum = 0 miss = 0 test_case.times do time, str = gets.chomp.split(' ') type = 12 * time.to_i / 1000 sum += type > str.length ? str.length : type miss += str.length - type if str.length > type end puts "#{sum} #{miss}"