In the land of Minion, there are 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 and decreasing a Minion's power by 1 will cost .
You need to find the minimum cost to make every Minion's power equal.
The input will be followed by an integer (), denoting the number of test case.
The first line of each test case will contain three integers , and (). The second line will contain integers denoting the power of Minions ().
Sum of over all the test cases .
For each test case, the only line of the output will contain the minimum cost to make every Minion’s power equal.
Input | Output |
---|---|
1 3 1 1 1 2 3 | 2 |