import sys #sys.setrecursionlimit(10 ** 6) INF = float('inf') #10**20,2**63に変えるのもあり MOD = 10**9 + 7 MOD2 = 998244353 from collections import defaultdict def solve(): def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) N,A,B,X,Y = MI() H =LI() from heapq import heappop, heappush def is_ok(K): # 条件を満たすかどうか?問題ごとに定義 Heap = [] for h in H: heappush(Heap, -(h-K)) for a in range(A): h = -heappop(Heap) h = h-X heappush(Heap,-h) SUM = 0 for n in range(N): h = -heappop(Heap) if h<=0: continue else: SUM += h return SUM <= B*Y def meguru_bisect(ng, ok): """ この条件は、問題に基づくやつじゃなくてもOK 条件の付け方は、ngとokの広げ方をどのようにするかで決まってくる。 (目的値)~正の無限 が条件を満たす場合 ng…条件を満たさない値の範囲での最大値 ok…条件を満たす値の範囲での最小値 ng < ok is_ok == Trueの場合、探索範囲が左半分へ is_ok == Falseの場合、探索範囲が右半分へ """ while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok print(meguru_bisect(-1,10**9)) return solve()