#include <bits/stdc++.h>
using namespace std;
#define ls (x << 1)
#define rs (x << 1 | 1)
// #define mid ((l + r) >> 1)
#define int long long
#define Rep(x, a, b) for(int x = a; x <= b; ++ x)
#define Dep(x, a, b) for(int x = a; x >= b; -- x)
#define Next(i, x) for(int i = head[x]; i ; i = e[i].nxt)
int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') { if(c == '-') f = -1;     c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
const int maxn = 2e5 + 10;
const int inf = 1e9;
int d[200000];
signed main() {
	int T = read();
	while(T --) {
		int n = read(), ans = 0, sm = 0;
		Rep(i, 1, n) d[i] = read();
		sort(d + 1, d + n + 1), ans += d[n];
		Rep(i, 1, n) sm -= d[i]; 
		Rep(i, 1, n - 1) ans += sm, sm += (d[i + 1] - d[i]) * (n - i);
		printf("%lld\n", ans);
	}
}