#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max()/32*15+208; int main() { ll n, k, x, y; cin >> n >> k >> x >> y; vector v(n); for (auto &&i : v) scanf("%d", &i); vector a(n); for (int i = 0; i < n; ++i) { a[i] = (v[i]-1+k-1)/k; } a.emplace_back(0); sort(a.begin(),a.end()); ll ans = INF, val = 0; for (int i = 0; i <= n; ++i) { val += a[i]; } for (int i = 0; i <= n; ++i) { val -= a[i]; while(i+1 <= n && a[i+1] == a[i]) val -= a[++i]; ans = min(ans, (val-(ll)(n-i)*a[i])*x+y*a[i]); } cout << ans << "\n"; return 0; }