import collections import numpy as np def main(): N,M,X=map(int,input().split( )) A=list(range(N)) B=list(range(N)) for num in range(N): A[num],B[num]=map(int,input().split( )) K=int(input()) s=0 t=0 D=np.zeros((N,N)) C=list(map(int,input().split())) for i in range(M): for j in range(N): if B[j]==i + 1: D[i][s]=A[j] s=s + 1 s=0 for i in range(len(collections.Counter(B))): for j in range(N): if A[j]==max(D[i]) and B[j]==i+1: A[j]=A[j] + X break E=sorted(A,reverse=True) for i in range(K): for j in range(C[i]): t=t+E[j] print(t) if __name__ == '__main__': main()