#include using namespace std; #define ll long long const int N=1e5+100; ll n,m,x,y; ll a[N]; ll ans; int main() { cin>>n>>m>>x>>y; for(int i=1;i<=n;i++) { cin>>a[i]; a[i]--; if(a[i]%m==0) a[i]/=m; else a[i]=a[i]/m+1; } sort(a+1,a+1+n); int left=n,now=0; for(int i=1;i<=n;i++) { a[i]-=now; if(!a[i]) { left--;continue; } if((ll)left*x>y) { left--; now+=a[i]; ans+=y*a[i]; } else { left--; ans+=x*a[i]; } } cout<