#include<bits/stdc++.h>
using namespace std;

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

const int N = 1e5 + 5;
int d[N];

int main()
{
	int T = read();
	while (T--)
	{
		int n = read();
		for (int i = 1; i <= n; ++i) d[i] = read();
		sort(d + 1, d + n + 1);
		long long ans = 0;
		for (int i = 1; i < n; ++i) 
			ans -= 1LL * (d[i + 1] - d[i]) * (1LL * i * (n - i) - 1);
		printf("%lld\n", ans);
	}
	return 0;
}
