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