import sys input = sys.stdin.readline N, M, X = map(int, input().split()) a = [tuple(map(int, input().split())) for _ in range(N)] import heapq hpush = heapq.heappush hpop = heapq.heappop h = [] table = [0] * (M + 1) for x, y in a: hpush(h, (-(x + X), y)) K = int(input()) qs = list(map(int, input().split())) qc = [0] * (N + 2) for x in qs: qc[x + 1] -= 1 qc[1] += K for i in range(N + 1): qc[i + 1] += qc[i] #print(qc) res = 0 for i in range(1, N + 1): while table[h[0][1]] == 1: x, y = hpop(h) hpush(h, (x + X, 0)) x, y = hpop(h) if y: table[y] = 1 x = -x res += x * qc[i] #print(x, y) print(res)