#include using namespace std; int main() { int64_t n, k, x, y; cin >> n >> k >> x >> y; vector as(n); for (auto &&a : as) { cin >> a; a--; } sort(as.begin(), as.end()); vector bs(n); for (int64_t i = 0; i < n; i++) { bs[i] = (as[i] + k - 1) / k; } int64_t sum = accumulate(bs.begin(), bs.end(), int64_t(0)); int64_t ans = min(x * sum, y * *max_element(bs.begin(), bs.end())); for (int64_t i = 0, tmp = 0; i < n; i++) { tmp += bs[i]; ans = min(ans, y * bs[i] + x * (sum - tmp - bs[i] * (n - i - 1))); } cout << ans << endl; return 0; }