#include using namespace std; typedef long long ll; typedef long double ld; typedef pair P; typedef pair Pi; #define rep(i,n) for(ll i=0;i inline bool chmax(T &a, T b){if(a inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;} template ostream& operator<<(ostream& s,const complex& d) {return s<<"("< ostream& operator<<(ostream& s,const pair& d) {return s<<"("< ostream& operator<<(ostream& s, const vector& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const vector>& d){int len=d.size();rep(i,len){s< ostream& operator<<(ostream& s,const set& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const multiset& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;} template ostream& operator<<(ostream& s,const map& m){s<<"{"<>n>>k>>x>>y; vector a(n),cnt(n),sum(n+1,0); rep(i,n){ cin>>a[i]; a[i]--; cnt[i]=(a[i]+k-1)/k; } sort(begin(cnt),end(cnt)); rep(i,n){ sum[i+1]=sum[i]+cnt[i]; } ll ans=inf; rep(i,n+1){//i-1まで全体魔法で消す ll now=0; if(i){ now=cnt[i-1]*y+(sum[n]-sum[i]-cnt[i-1]*(n-i))*x; }else{ now=sum[n]*x; } chmin(ans,now); } cout<