#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int n, a, b; long long x, y; bool check(vector &hh, long long H) { vector h(hh); int a_res = a; for (int i = 0; i < n; i++) { h[i] = max(0LL, h[i] - H); long long cnt = min((long long)a_res, h[i] / x); h[i] -= cnt * x; a_res -= cnt; } if (a_res >= n) { return true; } sort(h.rbegin(), h.rend()); long long su = 0; for (int i = a_res; i < n; i++) { su += h[i]; } if (su <= y * b) { return true; } else { return false; } } int main() { fast_io(); cin >> n >> a >> b >> x >> y; vector h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } long long ng = -1, ok = 4e9; while (ok - ng > 1) { long long mid = (ok + ng) / 2; if (check(h, mid)) { ok = mid; } else { ng = mid; } } cout << ok << endl; }