#!/usr/bin/env pypy3 from pprint import pprint from string import ascii_lowercase as letter from sys import setrecursionlimit, stdin from typing import Dict, Iterable, Set INF: int = 1 << 62 MOD1000000007 = 10**9 + 7 MOD998244353 = 998244353 setrecursionlimit(500_000) readline = stdin.readline input = lambda: stdin.readline().rstrip('\r\n') def inputs(type_=int): ins = input().split() if isinstance(type_, Iterable): return [t(x) for t, x in zip(type_, ins)] else: return list(map(type_, ins)) def input_(type_=int): a, = inputs(type_) return a def input1() -> int: return int(readline()) inputi = input1 def input2(): a = readline().split() assert len(a) == 2 a[0] = int(a[0]) a[1] = int(a[1]) return a def input3(): a = readline().split() assert len(a) == 3 a[0] = int(a[0]) a[1] = int(a[1]) a[2] = int(a[2]) return a def input4(): a = readline().split() assert len(a) == 4 a[0] = int(a[0]) a[1] = int(a[1]) a[2] = int(a[2]) a[3] = int(a[3]) return a # start coding def ceil(b, a): return (a + b - 1) // a from bisect import bisect n, k, x, y = input4() A = inputs() A = [a - 1 for a in A] A.sort() A = [0] + A + [INF] n += 1 B = [0] * n for i in range(1, n): B[i] = B[i - 1] + ceil(A[i], k) res = INF for i in range(n): b = ceil(A[i], k) val = b * y # print(83, i, val) r = bisect(A, b * k) if r != n: # r ... n-1までの値を足す c = B[n - 1] - B[r - 1] - b * (n - r) # print(99, i, c, y) val += c * x # print(i, A, b, r, val) res = min(res, val) print(res)