#include #include #include using namespace std; using namespace atcoder; #define rep(i, l, n) for (int i = (l); i < (n); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define all(x) x.begin(), x.end() #define fi first #define se second #define lb lower_bound; #define ub upper_bound; //#define lb(A, x) (ll)(lower_bound(all(A), x) - A.begin()) //#define ub(A, x) (ll)(upper_bound(all(A), x) - A.begin()) using ll = long long; using P = pair; template using V = vector; template using VV = V >; template const ll INF = 1000000000000000001; const int inf = 1001001001; const ll mod = 1000000007; const ll MOD = 998244353; bool func(V&h,ll n,ll a,ll b,ll x,ll y,ll k) { set st{}; rep(i, 0, n) { st.insert(-h[i] + k); } rep(i, 0, a) { auto it = st.begin(); ll t = *it + x; //cout << *it << endl; st.erase(it); st.insert(t); } ll s = 0; while (st.empty() == false) { auto it = st.begin(); auto t = -(*it); st.erase(it); s += max(0, (ll)t); } if (s <= (ll)y * (ll)b) { return true; } return false; } int main(void) { ll n, a, b, x, y; cin >> n >> a >> b >> x >> y; ll mh = 0; V h(n); rep(i, 0, n) { cin >> h[i]; mh = max(mh, h[i]); } ll ok = mh; ll ng = -1; while (ok - ng > 1) { ll k = (ok + ng) / 2; if (func(h, n, a, b, x, y, k)) { ok = k; } else { ng = k; } } cout << ok << endl; return 0; }