#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) using namespace std; typedef pair P; llint n, k, x, y; llint a[100005]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k >> x >> y; llint h; for(int i = 1; i <= n; i++){ cin >> h; h--; a[i] = (h+k-1)/k; } sort(a+1, a+n+1); llint ans = inf*2, sum = 0; for(int i = n; i >= 0; i--){ if((sum-a[i]*(n-i)) <= ((llint)inf)/x){ ans = min(ans, a[i]*y + (sum-a[i]*(n-i))*x); sum += a[i]; } } cout << ans << endl; return 0; }