from collections import Counter import heapq import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M, X = map(int, input().split()) P = [] for _ in range(N): a, b = map(int, input().split()) b -= 1 P.append((-a, b)) used = [False] * M order = [] heapq.heapify(P) Q = [] def push(que): a, b = heapq.heappop(que) used[b] = True order.append((-a, b)) for _ in range(N): while P and used[P[0][1]]: heapq.heappush(Q, heapq.heappop(P)) if P and Q: if (-P[0][0] + X) > -Q[0][0]: push(P) else: push(Q) elif P: push(P) else: push(Q) K = int(input()) C = Counter(map(int, input().split())) ans = 0 used = [False] * M score = 0 for i, (a, b) in enumerate(order, 1): score += a if not used[b]: score += X used[b] = True ans += C[i] * score print(ans)