#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 1e5 + 7;
const int maxm = 2e5 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;

int a[maxn];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int t;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		ll sum = 0;
		for (int i = 0; i < n; i++)
			cin >> a[i];
		sort(a + 1, a + n);
		for (int i = 1; i < n; i++)
			sum += 1ll * (i + 1) * a[i] - 1ll * (n - i) * a[i];
		cout << -(sum - a[n - 1]) << '\n';
	}

	return 0;
}

