#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl "\n"
#define ll long long
#define ull unsigned long long
#define pb push_back
#define vll vector<ll>
#define size(v) (v.empty() ? 0 : v.size())
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define fr(i,n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define tr(v) for(auto it=v.begin();it!=v.end();it++)
const ll inf = LLONG_MAX/2;

const ll maxP = 100000;
bool is_prime[maxP];
void sieve(){
    memset(is_prime,true,sizeof(is_prime));
    is_prime[0] = false;
    is_prime[1] = false;
    for(ll i=2;i*i<=maxP;i++){
      if(is_prime[i]){
        for(ll j=i*i;j<=maxP;j+=i)
          is_prime[j] = false;
      }
    }
}

ll power(ll b,ll e,ll m)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}

void solve()
{
    ll n;
    cin>>n;
    vll a(n);
    fr(i,n) cin>>a[i];
    sort(all(a));

    ll maxi = a[n-1];
    if(n == 1){
    	cout<<"0\n";
    	return ;
    }
    if(n == 2){
    	cout<<"0\n";
    	return ;
    }
    vll prefix;
    for(ll i=1;i<n;i++)
    	prefix.push_back(a[i] - a[i-1]);
    vll prefix1(n,0);
    ll k = n-1;
    ll ans = prefix[0];
    prefix1[0] = prefix[0];
    for(ll i=1;i<k;i++){
    	prefix1[i] = prefix1[i-1] + prefix[i];
    	ans += prefix1[i];
    }
    // cout<<"ans = "<<ans<<endl;
    ll temp = ans;
    for(int i=0;i<k;i++){
    	temp = temp - prefix[i]*(k-i);
    	// cout<<temp<<" "<<ans<<endl;
    	ans += temp;
    	// ans += (temp-prefix[i])
    	// temp = temp-prefix[i]*(k-i);
    	// cout<<ans<<" ";
    }
    // cout<<endl;
    cout<<-1 * (ans - prefix1[k-1])<<endl;
}

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    fast;
    ll t;
    t =1;
    cin>>t;
    while(t--)
        solve();
}