Minions and War
In the land of Minion, there are N Minions. They have their own power to survive themselves from enemy.
The power of every Minion may not always be equal. But, their power must to be equal as you don’t want a war among themselves. So, you need to make the every Minion’s power equal.
You can increase or decrease any Minion’s power by 1 as many time as you want.
But nothing is free here! Increasing a Minion’s power by 1 will cost P and decreasing a Minion’s power by 1 will cost Q.
You need to find the minimum cost to make every Minion’s power equal.
The input will be followed by an integer T, denoting the number of test case.
The first line of each test case will contain three integers N, P and Q. The second line will contain N integers denoting the power of Minions.
1 ≤ T ≤ 10
1 ≤ N, P, Q ≤ 106
1 ≤ Minion’s Power ≤ 106
Sum of N over all the test cases ≤ 8 * 106
For each test case, the only line of the output will contain the minimum cost to make every Minion’s power equal.
1 3 1 1 1 2 3