# frozen_string_literal: true N, M, K = gets.chomp.split.map(&:to_i) ROW = gets.chomp.split OP = ROW[0].intern BS = ROW[1..-1].map(&:to_i).sort AS = N.times.map { gets.to_i } puts(AS.map do |a| M - (BS.bsearch_index do |b| case OP when :+ a + b >= K else a * b >= K end end || M) end.sum)