import bisect import sys import itertools input=sys.stdin.readline def main(args): N, K, X, Y = map(int,input().split()) A = list(map(lambda x:-(-(int(x)-1)//K), input().split())) A.sort() if Y <= X: print(A[-1]) else: ans = float('inf') cumsum = list(itertools.accumulate(A)) cumsum = [0] + cumsum for i in range(N):#A[i]:ベホマラーの回数 behoimi = cumsum[-1] - cumsum[i+1] - (N-(i+1))*A[i] mp = A[i]*Y + behoimi*X ans = min(ans, mp) ans = min(ans, cumsum[-1]*X) print(ans) if __name__ == '__main__': main(sys.argv[1:])