Emily is starting a hip new bakery that serves spicy cupcakes. In fact, she wants her cupcakes to be the spiciest in town! To come up with the optimal lineup for the town's spicy cupcake competition, she has enlisted your help.
Emily's shop sells $$$N$$$ types of cupcakes, the $$$i^\text{th}$$$ of which has an associated spiciness $$$s_i$$$. The judge of the spicy cupcake competition will eat one of each of the types of cupcakes. If the judge has eaten $$$j$$$ cupcakes so far (initially, $$$j = 0$$$), then eating a cupcake with spiciness $$$s$$$ will increase the "cumulative spiciness" value that the judge tallies by $$$$$$(j + 1) \cdot (A \cdot s + B)$$$$$$ where $$$A$$$ and $$$B$$$ are what are known as "cupcake constants".
Emily really wants the judge to feel the heat so that her cupcakes can be deemed the spiciest in town. She wants you to arrange her cupcakes in a line in such a fashion that maximizes the cumulative spiciness value that the judge tallies after eating one of each type of cupcakes in the specified order.
The first line of input will contain a three space-separated integers $$$N\ \left(1 \leq N \leq 10^5\right)$$$ and $$$A, B\ \left(-10^3 \leq A, B \leq 10^3\right)$$$ representing the number of types of cupcakes that Emily's bakery sells as well as the two "cupcake constants", respectively.
The second line of input will contain $$$N$$$ space-separated integers $$$s_i\ \left(1 \leq s_i \leq 10^3\right)$$$ representing the spiciness of the $$$i^\text{th}$$$ type of cupcake that Emily's bakery sells for each $$$i \in \{1, 2, \dots, N\}$$$.
Output a single integer which represents the maximum cumulative spiciness value of Emily's cupcakes attainable across all possible orderings of her cupcake types.
3 1 13 5 8
43
4 2 410 10 10 10
240
In the first sample test case, one possible ordering would be $$$(5, 8, 3)$$$, which would yield a cumulative spiciness value of $$$(0 + 1) \cdot (1 \cdot 5 + 1) + (1 + 1) \cdot (1 \cdot 8 + 1) + (2 + 1) \cdot (1 \cdot 3 + 1) = 19$$$.
In the second sample test case, all possible orderings yield the same cumulative spiciness value of $$$(0 + 1) \cdot (2 \cdot 10 + 4) + (1 + 1) \cdot (2 \cdot 10 + 4) + (2 + 1) \cdot (2 \cdot 10 + 4) + (3 + 1) \cdot (2 \cdot 10 + 4) = 240$$$.