#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
#define vi vector<int>
#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define FOR for(int i=a;i<b;++i)
#define sq(a) (a)*(a)
#define vll vector<long long> 
const int inf=INT_MAX; 
const ll INF=LLONG_MAX; 
const int MOD=1000000007; 
//char-48
int dp[100000]; 
int main(){
	ios::sync_with_stdio(0); 
	cin.tie(0); 	
	ll t; 
	cin >> t; 
	while(t--){
		ll n, ans=0; 
		cin >> n; 
		vector<ll> v; 
		for(ll i=0;i<n;++i){
			ll u; 
			cin >> u; 
			v.pb(u);
		       	ans=max(ans,u); 	
		}
		sort(v.begin(), v.end()); 
		ll b=v.size()-1; 
		ll g=b; 
		for(ll i=0; i<b; ++i){
			ans+=(v[i]-v[i+1])*(g*(i+1));  
		       	
			--g; 	
		}
		cout << ans << "\n"; 
			
	}	
}

//Erase reps
//	sort(v.begin(), v.end() );
//	v.erase(unique(v.begin(), v.end() ), v.end());

//Find something to eliminate
//	auto i = find(begin(s), end(s), "{");
//	s.erase(i);


