import collections N,M,X = map(int,input().split()) lsAB = collections.defaultdict(lambda :[]) for i in range(N): a,b = map(int,input().split()) lsAB[b].append(a) K = int(input()) lsC = list(map(int,input().split())) for key in lsAB.keys(): lsAB[key].sort(reverse=True) for key in lsAB.keys(): lsAB[key][0] += X lsAll = [] for key in lsAB.keys(): for i in lsAB[key]: lsAll.append(i) lsAll.sort(reverse=True) lssum = [0] for i in range(N): lssum.append(lssum[-1]+lsAll[i]) ans = 0 for i in range(K): ans += lssum[lsC[i]] print(ans)