#include #define rep(i,n) for(ll i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; constexpr double PI = 3.14159265358979323846; int main(){ ll n; cin >> n ; ll k,x,y; cin >> k >> x >> y; vector a(n); rep(i,n){ cin >> a[i]; --a[i]; } sort(a.begin(),a.end()); rep(i,n) a[i] = (a[i]+k-1)/k; //rep(i,n) cout << a[i] << endl; vector cumsum(n,0); cumsum[n-1] = a[n-1]; for(int i=n-2;i>=0;i--) cumsum[i] = cumsum[i+1] + a[i]; //rep(i,n) cout << cumsum[i] << endl; /* if(y >= n*x){ cout << cumsum[0] * x << endl; return 0; } */ ll ans = cumsum[0] * x; rep(i,n-1){ ll res = a[i] * y; res += x * (cumsum[i+1] - (n-i-1)*a[i]); ans = min(ans,res); } ll res = a[n-1] * y; ans = min(ans,res); cout << ans << endl; return 0; }