N, M, K = gets.split.map(&:to_i) op, *cols = gets.split op = op.to_sym B = cols.map{|b| b.to_i} A = N.times.map{ gets.to_i} A.sort! ans = B.inject(0) do |s,b| c = A.bsearch_index do |a| a.send(op,b) >= K end s + (c ? N - c : 0) end puts ans