#include<algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
#define int long long
const int N = 1e5 + 10;

int n;
int a[N];

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

signed main() {
    int T;
    scanf("%lld", &T);
    while (T--) {
        solve();
    }
    return 0;
}