safe = 0 out = 0 gets.to_i.times do time, str = gets.split possible_size = time.to_i * 12 / 1000 clear = possible_size >= str.size ? true : false safe += clear ? str.size : possible_size out += clear ? 0 : str.size - possible_size end puts "#{safe} #{out}"