#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {

        long long int n, sum;
        cin >> n;
        long long int arr[n];
        for (int i = 0; i < n; i++)
            cin >> arr[i];
        sort(arr, arr + n);
        sum = arr[n - 1];
        long long int ne[n];
        ne[0] = 0;
        for (int i = 1; i < n; i++)
        {
            ne[i] = ne[i - 1] + i * (arr[i] - arr[i - 1]);
            sum -= ne[i];
        }
        cout << sum << endl;
    }

    return 0;
}