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

void solve(){
   
   ll n; 
   cin >> n;

ll maxi = 0;

vector<ll>v(n);
  

for ( ll i=0; i<n; i++){
   cin >> v[i];
  maxi = max ( maxi  , v[i]);
}

 
 if(n<=2){
    cout <<"0\n"; 
 }

 else{


sort(v.begin() , v.end());


ll ans =0 ; 

ll count=n-1;
ll p1=0,p2=0,p3=0;

ll l=n-1;
ll r=1;


for ( ll i=0; i<n-1 ; i++){

   p1+=(l*r)*(v[i+1]-v[i]);
   l--;
   r++;


}

cout << maxi-p1 << "\n";

 }

  


 

}
 
 int   main(){


   //  ios_base::sync_with_stdio(false);
   //  cin.tie(NULL); 

    ll t;

    cin >>t;

    while( t-- ){
       solve();
    }
    
    return 0;
    


 }
      