P1843 Cow Drying Clothes

Background

Aunt Xiong (Xiong dama) decides to dress each calf in a cute baby outfit. However, since the clothes are very wet, drying them for the calves becomes an unpleasant task. So, Aunt Xiong asks you (the cow) to help her complete this important job.

Description

In natural conditions, one second of sun-drying reduces a garment’s humidity by $a$ units. The stingy Aunt Xiong only bought one dryer. Using the dryer for one second additionally dries $b$ units of humidity for a single garment (i.e., in one second it can dry $a+b$ humidity), but at the same time only one garment can be machine-dried. There are $n$ garments, and the humidity of the $i$-th garment is $w_i$ (guaranteed to be pairwise distinct). Find the minimum time needed to dry all garments (a garment is considered dry when its humidity is $0$).

Input Format

The first line contains three integers $n,a,b$. The next $n$ lines: on the $i$-th of these lines, input $w_i$.

Output Format

Output one line: the minimum time to dry all garments.

Explanation/Hint

Sample Explanation Dry the third garment with the machine to finish in one second. Constraints $1 \le w_i,a,b,n \le 5 \times 10^5$. Translated by ChatGPT 5