import heapq import itertools import collections d = collections.defaultdict(list) N,M,X = map(int, input().split()) for i in range(N): a,b = map(int, input().split()) heapq.heappush(d[b],-a) MQ = [(1,0)] for k,v in d.items(): q = heapq.heappop(v) heapq.heappush(MQ, (q,k)) USED = [0] K = int(input()) C = list(map(int, input().split())) CNT = [0]*(N+2) CNT[0] = K for c in C: CNT[c+1]-=1 AC = list(itertools.accumulate(CNT)) ans = 0 for i in range(1,N+1): mused = heapq.heappop(USED) mqq,mqk = heapq.heappop(MQ) if mqk != 0 and mused>=mqq-X: ans -= (mqq-X)*AC[i] heapq.heappush(USED, mused) while len(d[mqk]): temp = heapq.heappop(d[mqk]) heapq.heappush(USED, temp) else: ans -= mused*AC[i] heapq.heappush(MQ, (mqq,mqk)) print(ans)