#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int maxn = 1e6 + 10;

int a[maxn];

void solve() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    ll ans = a[n - 1];
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        ans -= 1ll * i * a[i] - sum;
        sum += a[i];
    }
    printf("%lld\n", ans);
}

int main() {
    int t;
    cin >> t;
    while (t--) solve();
}