#------------------------------------------------------------------- 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())) B = sorted(A) C = [math.ceil((b-1)/K) for b in B] p("B=",B) p("C=",C) hp = 1 ans = 0 for i in range(N): if B[i] <= hp: continue if (N-i)*X >= Y: ans += Y hp += K continue zan = B[i] - hp kai = math.ceil(zan / K) ans += kai * X B[i] -= kai * K print(ans)