#include<bits/stdc++.h>

#define ll long long

using namespace std;

const int N = 2e5 + 5;

int t;
ll n;
ll d[N];
ll sum, ans;

int main() {
    cin >> t;
    while (t--) {
        cin >> n;
        sum = 0;
        ans = 0;
        for (int i = 1; i <= n; i++) {
            cin >> d[i];
        }
        sort(d + 1, d + n + 1);
        for (int i = 3; i <= n; i++) {
            ans += d[i] * (i - 2);
        }
        for (int i = 2; i <= n - 2; i++) {
            ans -= d[i] * (n - i - 1);
        }
        //for (int i = 2; i <= n; i++) {
        //    for (int j = 1; j <= n - i; j++) {
        //        ans += d[j + i] - d[j];
        //    }
        //}
        cout << -ans << endl;
    }
    return 0;
}
