#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+5;
const int inf=0x3f3f3f3f;
ll a[N];
int main()
{
	ll t;
	cin >> t;
	while (t--){
		int n;
		cin >> n;
		for (int i=0;i<n;i++){
			cin >> a[i];
		}
		sort(a,a+n);
		ll c=0,s=0;
		for (int i=2;i<n;i++){
			s+=a[i-2];
			c-=(a[i]*(i-1));
			c+=s;
		}
		cout << c << endl;
	}
	
}