#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5;
int s[N + 5];
signed main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> s[i];
        sort(s + 1, s + 1 + n);
        int ans = s[n];
        for (int i = 1; i < n; i++)
            ans -= (s[i + 1] - s[i]) * i * (n - i);
        cout << ans << endl;
    }
    return 0;
}