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

int main()
{
    int kase;
    cin >> kase;
    while (kase--)
    {
        int n;
        cin >> n;
        ll arr[n];
        for (int i = 0; i < n; i++)
            cin >> arr[i];
        ll sum = 0;

        sort(arr, arr + n);
        ll last = -1;
        ll his = 0;
        ll pre = 0;
        for (int i = 1; i < n; i++)
        {
            if (arr[i] == last)
                sum += his;
            else
            {
                his = (arr[i] * i) - pre;
                sum += his;
            }
            pre += arr[i];
            last = arr[i];
           // cout << sum << endl;
        }
        sum -= arr[n - 1];
        if (sum != 0)
            sum = -1ll * sum;
        cout << sum << endl;
    }

    return 0;
}