#include <bits/stdc++.h>
#define f first
#define s second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3fll
using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;
const int SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);

void test_case(){
	int n;
	cin >> n;
	vector<ll> v(n);
	for(auto &x: v) cin >> x;
	sort(v.begin(), v.end());
	ll ans = 0, p = 0;
	for(int i = 1; i < n; i++){
		p -= i * (v[i] - v[i-1]);
		ans += p;
	}
	ans += v.back();
	cout << ans << endl;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int t = 1;
	cin >> t;
	for(int i = 1; i <= t; i++){
		//cout << "Case #"<< i << ":" << endl;
		test_case();
	}
	return 0;
}