#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define oset ordered_set
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define endl "\n"
#define N 10000010
#define de(text) if(do_debug) {cout << (#text) << ": " << text << endl;}
template <typename T> ostream& operator<<(ostream& os, vector<T>& v) {
    if(v.size() == 0) { os << "empty vector\n"; return os; }
    for(auto element : v) os << element << " ";return os;  }
template <typename T, typename S> ostream& operator<<(ostream& os, pair<T, S>& p) {
    os << "(" << p.first << ", " << p.second << ")"; return os;  }
template <typename T> ostream& operator<<(ostream& os, set<T>& v) {
    if(v.size() == 0) {  os << "empty set\n"; return os; }
    auto endit = v.end();  endit--;  os << "[";
    for(auto it = v.begin(); it != v.end(); it++) { os << *it; if(it != endit) os << ", "; }
    os << "]"; return os;  }
template <typename T> ostream& operator<<(ostream& os, multiset<T>& v) {
    if(v.size() == 0) { os << "empty multiset\n"; return os; }
    auto endit = v.end(); endit--; os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
      os << *it; if(it != endit)  os << ", "; }
      os << "]"; return os;  }
template <typename T, typename S> ostream& operator<<(ostream& os, map<T, S>& v) {
    if(v.size() == 0) { os << "empty map\n"; return os; }
    auto endit = v.end(); endit--; os << "{";
    for(auto it = v.begin(); it != v.end(); it++) {
        os << "(" << (*it).first << " : " << (*it).second << ")";
        if(it != endit)  os << ", "; } os << "}"; return os; }
template <typename T> ostream& operator<<(ostream& os, vector<vector<T>>& v) {
    for(auto& subv : v) { for(auto& e : subv) os << e << " "; os << "\n"; } return os; }

bool do_debug = false;

void Runtime_Terror()
{
    ll n;
    cin>>n;
    vector<ll> v(n);
    rep(i,0,n) cin>>v[i];
    sort(all(v));
    if(n<=2) 
    {
        cout<<0<<endl;
        return;
    }          
    ll ans = 0;
    // rep(i,0,n) tsum += v[i];
    // cout<<(-1)*v[n-1]<<endl;                                    
    // rep(i,1,n)
    // {
    //     if(v[i]<v[i-1])
    //     {
    //         ans += abs(v[i]-v[i-1]);
    //     }
    // }                       
    // cout<<(-1)*(ans+v[n-1])<<endl;
    
    vector<ll> dv;
    rep(i,1,n)
    {
        dv.pb(v[i]-v[i-1]);
    }
    vector<ll> tem(dv.size());
    // cout<<dv<<endl;
    tem[0] = dv[0];
    ans = dv[0];
    rep(i,1,dv.size())
    {
        tem[i] = tem[i-1] + (i+1)*dv[i];
        ans += tem[i];
    }
    ans *=(-1);
    // cout<<tem<<endl;
    // cout<<ans<<endl;
    cout<<ans+v[n-1]<<endl;

                                                         
                                                         
}
int main()
{
   //freopen("input.txt", "r", stdin);
   //freopen("ans.txt", "w", stdout);
   ios_base::sync_with_stdio(false); cin.tie(NULL);
   int t=1;
     cin>>t;
   rep(i,0,t) Runtime_Terror();
   return 0;
}

