# 想定解法でやってみる N, K, X, Y = map(int, input().split()) A = list(map(int, input().split())) AK = [0] for a in A: calc = (a-1+K-1)//K AK.append(calc) AK.sort() #print(AK) if sum(AK) == 0: print(0) exit() ans = 0 y = 0 for i in range(N): remaining = N-i if X*remaining > Y: y = i+1 else: ans += (AK[i+1]-AK[y])*X ans += AK[y]*Y print(ans)