#include <bits/stdc++.h>
using namespace std;
#define ll long long
#include<vector>
#include<climits>
#include<algorithm>
#include<string>
#include<sstream>
#include<map>
#include<unordered_map>
#include<set>
#include<math.h>
#define pb push_back
#define read(a,n) for( ll i=0 ; i<n ; i++ )cin>>a[i];
#define vec(a,n) vector<ll> a(n);
#define sort(a) sort(a.begin() , a.end());
#define reverse(a) reverse(a.begin() ,a.end());
#define replace(s,pos,str) s.replace(pos,1,str);
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)


#ifndef ONLINE_JUDGE
#define deb(x) {cerr << #x <<" = "; _print(x); cerr << endl;}
#else
#define deb(x)
#endif

typedef unsigned long long ull;
typedef long double lld;

void _print(ll t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

#define google(x) "Case :"<<x<<" ";
const ll mod = 1e9 + 7;

ll factors( ll n ) {

// total no of factors pf n is approx = cube root of n

  ll cnt = 0;

  ll i = 1;
  for ( i ; i * i <=  n ; i++ ) {
    if ( n % i == 0 ) {
      cnt += 2;
      if ( i * i == n )
        cnt--;
    }
  }
  return cnt;

}

ll prime_factorization( ll n ) {

  ll cnt = 0;
  for ( ll i = 2 ; i * i < n ;  i++ ) {
    if ( n % i == 0 ) {
      while ( n % i == 0 ) {
        cnt++;
        n /= i;
      }
    }
  }

  if ( n != 1 ) {
    cnt++;
  }

  return cnt;

}

ll no_of_prime( ll n ) {

// no of primes between 1 to n is appox (n/ln(n))
// ln is natural log with base of e

  //n <= 10^3
  // naive approach
  // ll cnt =0;
  // for( ll i=2 ; i<=n ; i++ ){
  //   bool p = true;
  //   for( ll j=2 ; j*j<=i ; j++ ){
  //     if( i%j == 0 && j != 1 ){
  //       p = false;
  //     }
  //   }
  //   if( p ){
  //     cnt++;
  //   }
  // }

  //  this approach will take nsqr(n) time

  // another approach which take nlog(n) time
  //seive

  // n <= 10^6
  ll prime[n + 1];
  for ( ll i = 1 ; i <= n ; i++ ) {
    prime[i] = 1;
  }

  for ( ll i = 2 ; i <= n ; i++ ) {
    if ( prime[i] == 1 ) {
      // here we can use j = i*i but take care of integer overflow
      for ( ll j = i * i ; j <= n ; j += i ) {
        prime[j] = 0;
      }
    }
  }

  // n/1 + n/2 + n/3 + n/4 ---- n/n ~ nlog(n)

  // but if we take sum(n / i) where i are prime is approx = nlog(log(n))

  ll cnt = 0;
  for ( ll i = 2 ; i <= n ; i++ ) {
    if ( prime[i] ) {
      cnt++;
    }
  }

  return cnt;


  // space saving sieve of eratosthesnes
  // if instead of using prime array we can use bit to store whether particluar no is prime or not
  // n/32


  // total no of distinct prime no are very less
  // 10^6 has max 7 disinct prime no

}

ll power_func( ll a,  ll n , ll d) {

  ll res = 1;
  while ( n ) {

    if ( n % 2 == 1 ) {
      res = ((res % d) * (a % d)) % d;
      n--;
    } else {
      a = ((a % d) * (a % d)) % d;
      n /= 2;
    }

  }

  return res;
}

ll modular_multiplicative_inverse( ll x , ll a , ll m ) {

  // (a * b) % m == 1

  // (x / a) % m = (x * b) % m
  // hence first find b then cal modular_multiplicative_inverse


  // fermat's little theorem = if m is prime , and a belongs to ( 1 , m-1 )
  // then   (a^m)%m = a%m
  // multiply b on both side
  //(a ^ m - 1 * a * b) % m = (a * b) % m
  //(a ^ m - 1) % m = 1
  //(a * (a ^ m - 2)) % m = 1
  //(b = a ^ (m - 2))

  ll b = power_func(a, m - 2, m);
  return (x * b) % m;

}

ll fact[2000001];
ll infact[2000001];


ll ncr( ll n , ll r ) {

  if ( r > n || n < 0 || r < 0 ) {
    return 0;
  }

  // ncr  + ncr-1 = n+1cr
  // ncr = ncn-r
  // sum(nci) = 2^n

  //r = 0 to r = k ( SUM(ncr(n + r, r)) ) = ncr(n + k + 1 , k + 1)


  // now to cal ncr
  // 1)  we can make a pascal triangle in o(n ^ 2) and then cal ncr in order of 1
  // 2)  or we can use modular modular_multiplicative_inverse to cal ncr by (n!) / (r!)*((n - r)!)
  // here we have to cal modular_multiplicative_inverse of r! and (n - r)!

  // we use 2 option when modular is prime otherwise we use 1 option

  // we see modular_muliplicatiive approach

  // globally

  fact[1] = 1;
  fact[0] = 1;

  ll mx = 200000;

  for ( ll i = 2 ; i <= mx ; i++ ) {
    fact[i] = ( i * 1LL * fact[i - 1] ) % mod;
  }


  infact[mx] = modular_multiplicative_inverse(1, fact[mx], mod) % mod;
  //(1 / x!)*x = 1 / (x - 1)!
  //infact[x - 1] = x * infact[x];

  for ( ll i = mx - 1 ; i >= 0 ; i-- ) {
    infact[i] = ((i + 1) * 1LL * infact[i + 1]) % mod;
  }

  return ( fact[n] * ( infact[r] ) % mod * ( infact[n - r] ) % mod ) % mod;

}

void solve() {

  ll n;
  cin >> n;
  vector<ll> d(n);
  read(d, n);
  sort(d) ;
  vector<ll> x;

  for ( ll i = 0 ; i < n - 1 ; i++ ) {
    
      x.push_back(d[i] - d[i + 1]);
    
  }

  reverse(x);

  ll sum = 0;
  ll total = 0;

  for ( ll i = 0 ; i < x.size() ; i++ ) {
    total += x[i] * (x.size() - i);
  }

  sum += total;

  for ( ll i = 0 ; i < x.size() ; i++ ) {
    total -= x[i] * (x.size() - i);
    sum += total;
  }

  cout << d[n - 1] + sum << endl;

}


int main() {

  fast_io;
  ll t = 1;
  cin >> t;
  while ( t > 0 ) {
    solve();
    t--;
  }

}