#include using namespace std; #define int long long templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (bsputn(d, len) != len) { dest.setstate(std::ios_base::badbit); } } return dest; } __int128 parse(string &s) { __int128 ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } signed main(){ int n, k, x, y; cin >> n >> k >> x >> y; int a[100010]; for(int i = 0;i < n;i++){ cin >> a[i]; a[i]--; } int m = n; map<__int128, __int128> mp; __int128 cnt = 0; for(int i = 0;i < n;i++){ int tmp = (a[i]+k-1)/k; mp[tmp]++; cnt += tmp; } __int128 ans = cnt * x; __int128 old = 0; for(auto e : mp){ cnt -= m * (e.first-old); old = e.first; m -= e.second; chmin(ans, x*cnt + y*e.first); } cout << ans << endl; return 0; }