The student of ADA University Huseyn Hajiyev is moving to Seul to study at Chung-Ang University. He has many friends there, all of them living on Heukseok-ro street. Since he will visit all his friends very often, he is trying to find a house close to them.
Huseyn wants to minimize the total distance to all of his friends.
The first line contains the number of test cases.
For each test case, you are given the integer number of friends n(0<n≤5000) and the house numbers s1,s2,...,si,...,sn(0<si<30000) where they live. Note that several friends could live in the same house.
For each test case, print the minimal sum of distances from the optimal Huseyn’s house to each one of his friends. The distance between two house numbers si and sj is dij=∣si−sj∣.