N, M, X = gets.split(" ").map{|s| s.to_i} A = Hash.new {|hash, key| hash[key] = Array.new} N.times { a, b = gets.split(" ").map{|s| s.to_i} A[b] << a } k = gets.to_i c = gets.split(" ").map{|s| s.to_i} list = [] A.values.each {|v| i = v.each_with_index.max[1] v[i] += X list += v } list.sort! cnt = [0] 1.upto(c.max) {|i| cnt << cnt[-1] + list[N-i] } total = 0 c.each {|i| total += cnt[i] } puts total