import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); Question[] questions = new Question[n]; for (int i = 0; i < n; i++) { questions[i] = new Question(sc.nextInt(), sc.nextInt()); } Arrays.sort(questions, new Comparator() { public int compare(Question q1, Question q2) { if (q1.type == q2.type) { return q2.value - q1.value; } else { return q1.type - q2.type; } } }); int prev = 0; for (Question q : questions) { if (q.type != prev) { prev = q.type; q.value += x; } } Arrays.sort(questions, new Comparator() { public int compare(Question q1, Question q2) { return q2.value - q1.value; } }); long[] sums = new long[n + 1]; for (int i = 0; i < n; i++) { sums[i + 1] = sums[i] + questions[i].value; } long ans = 0; int k = sc.nextInt(); for (int i = 0; i < k; i++) { ans += sums[sc.nextInt()]; } System.out.println(ans); } static class Question { int value; int type; public Question(int value, int type) { this.value = value; this.type = type; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }