#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

long long d[N];
long long dis[N], s[N];

void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> d[i];
    sort(d + 1, d + n + 1);
    long long res = 0;
    for (int i = 1; i <= n; i++) s[i] = s[i - 1] + d[i];
    for (int i = 1; i <= n; i++) {
        if (i - 2 >= 0) res += (long long)(i - 2) * d[i] - s[i - 2];
        // for (int j = 1; j <= i - 2; j++) {
        //     res += d[i] - d[j];
        // }
    }
    cout << -res << endl;
}

int main() {
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}