#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <ctype.h>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
using PDD = pair<double, double>;
//const int INF = 0x3f3f3f3f;
//const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 1e5 + 10;
LL d[N];
LL s[N];

void solve() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> d[i];
    sort(d + 1, d + 1 + n);
    for(int i = 1; i <= n; i++) s[i] = s[i - 1] + d[i];
    LL ans = 0;

    for(int i = 3; i <= n; i++) {
        int len = n - i + 1;
        ans += s[n] - s[i - 1] - len * d[i - 2];
    }
    cout << -1 * ans << endl;
}

int main()
{
#ifdef LOCAL
    freopen("in.in", "r", stdin);
    freopen("out.out", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    cin >> T;
    while(T--)
        solve();
    return 0;
}