#------------------------------------------------------------------- import sys def p(*_a): _s=" ".join(map(str,_a)) #print(_s) sys.stderr.write(_s+"\n") #------------------------------------------------------------------- import math N,K,X,Y = map(int, input().split()) A = list(map(int, input().split())) maxA = max(A) if maxA==1: print(0) exit() B = sorted(A) # 回数、逆順、累積和 C=[0]*N for i in range(N)[::-1]: C[i] = math.ceil( (B[i]-1) / K ) if i < N-1: C[i] += C[i+1] #p("C = ",C) hp = 1 i = 0 ans = 0 while i= (math.ceil(maxA/K))*Y: hp += K ans += Y else: A[i] -= K ans += X print(ans)