#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>

#define ll long long
#define vi vector<int>
#define vii vector<ll>
#define umi unordered_map<int,int>
#define umii unordered_map<ll,ll>
#define mi map<int,int>
#define mii map<ll,ll>
#define pb push_back
#define pob pop_back
#define pof pop_front
#define all(vec) vec.begin(),vec.end()
#define present(c,x) ((c).find(x) != (c).end())
#define ff first
#define ss second
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopl(i,a,b) for(ll i=a;i<b;i++)
#define imx INT_MAX
#define imn INT_MIN
#define null nullptr
#define sz(v) (ll)v.size()
#define deb1(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<"   "<<#y<<" "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" "<<x<<"   "<<#y<<" "<<y<<"   "<<#z<<" "<<z<<endl;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi 3.141592653589793238
#define inf 1e15
#define mod 1000000007


using namespace std;

ll factorial(ll n)
{
	ll k=n;
	ll fact=1;
	if(n==0){
		return 1;
	}
	while(k>=1){
		fact*=k;
		k--;
	}
	return fact;
}
bool isPrime(ll n)
{
	if(n==1)return true;
	
	for(ll i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
ll power(ll x, ll y, ll p)//compute (x^y)%p--
{
    ll res = 1;
 
    x = x % p;
  
    if (x == 0) return 0;
 
    while (y > 0)
    {
       
        if (y & 1)
            res = (res*x) % p;
 
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
struct comp{
	bool operator()(pair<ll,ll>&a,pair<ll,ll>&b){
		
		return a.ff>b.ff;
		
	}
	
};

//-------------------------------My--Template--Above-----------------------------------------------

void solve()
{
	ll n;
	cin>>n;
	
	vii di(n);
	
	loopl(i,0,n)cin>>di[i];
	
	sort(all(di));
	
	ll ans=di[n-1];
	
	if(n==1){
		cout<<"0\n";
		return;
	}
	vii dp(n,0);
	
	dp[0]=0;
	
	for(ll i=1;i<n;i++){
		
		dp[i]=dp[i-1]+i*(di[i]-di[i-1]);
		ans-=dp[i];
		
	}
	
	cout<<ans<<"\n";
	return;
}

int main()
{
	boost
	ll t;
	cin>>t;
	while(t--){
		solve();
		
	}
	return 0;
}
