import sys input = sys.stdin.readline N,K,X,Y=map(int,input().split()) A=list(map(int,input().split())) R=[(a-1+K-1)//K for a in A] import heapq heapq.heapify(R) ANS=0 common=0 #print(R) while R: #print(ANS,R) while R and R[0]<=common: heapq.heappop(R) if len(R)*X>Y: ANS+=(R[0]-common)*Y common+=R[0]-common else: for t in R: ANS+=max(0,t-common)*X break print(ANS)