#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int N,A,B,X,Y,H[1 << 17]; void solve() { cin >> N >> A >> B >> X >> Y; for(int i = 0;i < N;i++) cin >> H[i]; int ng = -1,ok = (int)1e9; while(ok-ng > 1) { int mid = (ok+ng)/2; vector h(N); priority_queue> Q; for(int i = 0;i < N;i++) h[i] = H[i]-mid,Q.push(make_pair(h[i],i)); for(int i = 0;i < A;i++) { int id = Q.top().second; Q.pop(); h[id] -= X; Q.push(make_pair(h[id],id)); } long long S = 0; for(int i = 0;i < N;i++) S += max(0,h[i]); if(S <= (long long)Y*B) ok = mid; else ng = mid; } cout << ok << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); }