Shafaet did an excellent job of organizing the first HourRank round. As a reward, his professor gave him an array of numbers to play with. But Shafaet prefers playing with "beautiful" arrays, which are arrays that have equal elements.
The professor has one array with elements, and that array isn't always "beautiful.” To ensure array has equal elements, the professor has 2 options:
Choose two elements of array . DECREASE the first element by 1 and INCREASE the second element by 1. This operation costs coins.
Choose one element of array and INCREASE it by 1. This operation costs coins.
What’s the minimum number of coins the professor needs to turn his array into a “beautiful” array for Shafaet?
Input Format
The first line of input contains three space-separated integers: , , . Integer is the size of array . Integer is the number of coins needed to perform the first operation. Integer is the number of coins needed to perform the second operation.
The second line contains integers , representing array .
Constraints:
Output Format
In single line, print one integer number: the minimum number of coins required to make the "beautiful" array.
Sample Input 1:
4 1 2
3 4 2 2
Sample Output 1:
3
Sample Input 2:
3 2 1
5 5 5
Sample Output 2:
0
Explanation
In the first example, the professor has one array with elements. To perform the first operation, they must pay coin and, to perform the second operation, they must pay coins. The optimal strategy is:
-Perform the second operation on the fourth element. Now the array is {3, 4, 2, 3}. This costs 2 coins.
-Perform the first operation on the second and third element. The array is now "beautiful", and it looks like {3, 3, 3, 3}. This costs 1 coin.
The total amount of coins needed is + = .
In the second example, the array is already "beautiful". The professor would spend 0 coins.