#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; ll N, A, B, X, Y; vector H; bool f(ll k = 0) { priority_queue pque; for (int i = 0; i < N; ++i) { pque.push(max(0LL, H[i] - k)); } for (int i = 0; i < A; ++i) { ll h = pque.top(); pque.pop(); pque.push(h - X); } ll sum = 0; while (not pque.empty()) { ll h = pque.top(); pque.pop(); sum += max(0LL, h); } return (sum <= B * Y); } int main() { cin >> N >> A >> B >> X >> Y; H.resize(N); for (int i = 0; i < N; ++i) { cin >> H[i]; } if (f()) { cout << 0 << endl; return 0; } ll ng = 0; ll ok = LLONG_MAX; while (abs(ok - ng) >= 2) { ll k = (ok + ng) / 2; if (f(k)) { ok = k; } else { ng = k; } } cout << ok << endl; return 0; }