#include<bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define log1(a) for(auto x:a)cout << x <<" ";cout <<endl;
#define log2(a,r,c) for(int i=0;i<r;i++){for(int j=0;j<c;j++)cout<<a[i][j]<<" ";cout << endl;}

using namespace std;
int dx[]={0,0,1,-1},dy[]={1,-1,0,0};

void solve()
{
	int n; cin >> n;
	vector<int> arr(n);
	for(int& x : arr) cin >> x;
	sort(arr.begin(), arr.end());
	
	vector<int> p;
	for(int x : arr) p.push_back(x);
	
	for(int i=n-2; i>=0; i--) p[i] += p[i+1];
	
	if(n <= 2) cout << 0;
	else {
		
		int count = 0;
		for(int i=0; i<n-2; i++) {
			count += p[i+2];
			count -= (arr[i] * (n-i-2));
		}
		cout << (-1 * count);
	}
	cout << "\n";
}

int32_t main()
{
	fastio
	
	int T; cin >> T;
	for(int t=1; t<=T; t++)
	{
		solve();
	}
	
	return 0;
}