#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr char newl = '\n';

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    ll K, x, y;
    cin >> K >> x >> y;

    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    ll cnt = 0;
    for (int i = 0; i < n; i++) {
        if (x * (n - i) < y) {
            break;
        }

        ll cur = min(a[i], 1 + cnt * K);
        ll hoge = (a[i] - cur + K - 1) / K;
        cnt += hoge;
    }

    ll ans = cnt * y;
    for (int i = 0; i < n; i++) {
        ll cur = min(a[i], 1 + cnt * K);
        ans += (a[i] - cur + K - 1) / K * x;
    }
    cout << ans << newl;

    return 0;
}