#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;

const int MAX_N = 100005;

int n;
ll d[MAX_N];
ll prefSum[MAX_N];

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
 
	int tests; cin >> tests;
	while (tests--)
	{
		cin >> n;
		for (int i = 0; i < n; i++)
			cin >> d[i];
		sort(d, d + n);

		prefSum[0] = d[0];
		for (int i = 1; i < n; i++)
			prefSum[i] = d[i] + prefSum[i - 1];

		ll result = d[n - 1];
		for (int i = 1; i < n; i++)
			result -= (i * d[i] - prefSum[i - 1]);
		cout << result << '\n';
	}
 
	return 0;
}