#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#define pb push_back
#define debug(a) cout<<#a<<" = "<<a<<endl
#define mem(a,b) memset(a,b,sizeof(a))
#define lowbit(x) ((x)&(-x))
using namespace std ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef long double lld ;
typedef pair <int,int> PII ;
typedef pair <double,double> PDD ;
const double eps = 1e-8 ;
const double pi = acos(-1) ;
const int inf = 0x3f3f3f3f ;
const ll INF = 0x3f3f3f3f3f3f3f3f ;
const int N = 1e5 + 5 ;
ll n , m , a[N] ;

void solve()
{
	cin >> n ; 
	for(int i = 1 ; i <= n ; i ++ ) cin >> a[i] ; 
	sort(a + 1 , a + 1 + n) ; 
	ll s = 0 , res = 0 ; 
	for(int i = 1 ; i <= n ; i ++ )
	{
		res += s - (i - 1) * a[i] ;
		s += a[i] ; 
	}
	cout << res + a[n] << endl ; 
}

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