# frozen_string_literal: true N = gets.chomp.to_i STRINGS = N.times.map { gets.chomp.split } correct = 0 wrong = 0 STRINGS.each do |t, s| a = [s.size, Rational(12 * t.to_i, 1000).floor].min correct += a wrong += s.size - a end RESULT = [correct, wrong].join(' ') puts RESULT