from heapq import heappop,heappush,heapify from collections import defaultdict N,M,X = map(int,input().split()) ab = [] dic = defaultdict(list) for _ in range(N): a,b = map(int,input().split()) ab.append((a,b)) dic[b].append(a) K = int(input()) C = list(map(int,input().split())) q = [] for key in dic.keys(): tmp = dic[key] tmp_q = [] for i in range(len(tmp)): heappush(tmp_q,-tmp[i]) x = -heappop(tmp_q) heappush(q,-(x+X)) while tmp_q: x = -heappop(tmp_q) heappush(q,-x) memo = [] while q: x = -heappop(q) memo.append(x) for i in range(N-1): memo[i+1] += memo[i] ans = 0 for i in range(K): c = C[i] if c == 0: continue ans += memo[c-1] print(ans)