#include using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() const int mod = 1000000007; const long long INF = 1LL << 60; using ll = long long; ll N,A,B,X,Y; vector H; bool solve(ll K){ auto h=H; rep(i,N){ h[i]-=K; } priority_queue> que; rep(i,N){ que.push(make_pair(h[i],i)); } rep(iter,A){ auto Q=que.top(); ll maxh=Q.first; ll i=Q.second; que.pop(); h[i]-=X; if(h[i]<0) h[i]=0; que.push(make_pair(h[i],i)); } ll sum=0; rep(i,N){ sum+=h[i]; } return !(sum<=B*Y); } int main() { cin >> N >> A >> B >> X >> Y; H.resize(N); rep(i,N){ cin >> H[i]; } //[OK,NG)で考える ll OK=0; ll NG=1001001001; while(abs(OK-NG)>1){ ll mid=(OK+NG)/2; if(solve(mid)){ //midでtrueならOKの下界をmidにまで引き上げる OK=mid; } else{ //midでfalseならNGの上界を(mid-1)に引き下げる NG=mid; } } //OKにtrueの中で最も大きい整数が cout << OK+1 << endl; }