#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define p 1000000007  
#define pb push_back
#define pii pair<int,int>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define rep(i,a,b) for(int i=a;i<b;i++)
#define long_max 1000000000000000000
#define long_min -1000000000000000000
#define mapit(i,mp) for(auto i = mp.begin(); i!=mp.end(); i++)


/*int gcd(int a, int b)
{
    if(b == 0)
    return a;
    
    return gcd(b,a%b);
}*/
 
/*void dfs(int s, vector<int>adj[],int ans[],bool visited[])
{
    ans[ct++] = s;
    visited[s] = true;
    
    for(int i = 0; i<adj[s].size(); i++)
    {
        if(!visited[adj[s][i]])
        {
            dfs(adj[s][i],adj,ans,visited);
        }
    }
}*/
 
ll bip(ll n, ll b)
{
    if(b == 0)
    return 1;
    
    ll res = 1;
    while(b)
    {
        if(b%2 == 1)
        {
            //res = (res*n)%p;
            res = res*n;
        }
        
        b = b/2;
        //n = (n*n)%p;
        n = n*n;
    }
    return res;
}
 
/*ll solve(ll n, ll r)
{
    ll ansn = 1;
    for(ll i = 1; i<=n; i++)
    {
        ansn = (ansn*i)%p;
    }
    ll ansnr = 1;
    for(ll i = 1; i<=(n-r); i++)
    {
        ansnr = (ansnr*i)%p;
    }
    ll ansr = 1;
    for(ll i = 1; i<=r; i++)
    {
        ansr = (ansr*i)%p;
    }
    
    ansnr = bip(ansnr,p-2);
    ansr = bip(ansr,p-2);
    
   ll res = 1;
   res = (res*ansn)%p;
   
   res = (res*ansr)%p;
   
   res = (res*ansnr)%p;
   
   return res;
    
}*/
 
bool isprime(ll n)
{
    for(ll i = 2; i*i<=n; i++)
    {
        if(n%i == 0)
        return false;
    }
    
    return true;
}
 
/*ll fact(ll n)
{
    ll ans = 1;
    for(ll i = 2; i<=n; i++)
    {
        ans = (ans*i)%p;
    }
    return ans;
}*/
 
/*bool issafe(int i, int j, int n, int m)
{
    if(i>=0 && i<n && j>=0 && j<m)
    return true;
    
    return false;
}*/


/*int find(int u, int par[])
{
    if(par[u] == u)
        return u;

    return par[u] = find(par[u],par);
}

void uniona(int a, int b, int par[], int size[])
{
    if(a == b)
        return;

    if(size[a]>size[b])
    {
        par[b] = a;
        size[a] += size[b];
    }
    else
    {
        par[a] = b;
        size[b] += size[a];
    }
}*/


/*int buildtree(int st[], int a[], int l, int h, int pos, int height,int n){
    if(l == h){
        st[pos] = a[l];
        return st[pos];
    }

    int mid = (l+h)/2;
    int k1 = buildtree(st,a,l,mid,2*pos+1,height+1,n);
    int k2 = buildtree(st,a,mid+1,h,2*pos+2,height+1,n);

    if(height%2 == n%2){
        return st[pos] = k1^k2;
        return st[pos];
    }
    else{
        return st[pos] = k1|k2;
        return st[pos];
    }
}

int updatetree(int st[], int l, int h, int pos, int height, int uppos, int upval,int n){
    if(l == h){
        if(l == uppos){
            return st[pos] = upval;
        }
        else
        {
            return st[pos];
        }
    }

    if(l>uppos || h<uppos)
        return st[pos];

    int mid = (l+h)/2;

    int k1 = updatetree(st,l,mid,2*pos+1,height+1,uppos,upval,n);
    int k2 = updatetree(st,mid+1,h,2*pos+2,height+1,uppos,upval,n);

    if(height%2 == n%2)
    {
        return st[pos] = k1^k2;
    }
    else{
        return st[pos] = k1|k2;
    }
}*/

struct comp{
    bool operator() (const pii &a, const pii &b)const{
        int lena = a.second-a.first+1;
        int lenb = b.second - b.first + 1;

        if(lena == lenb)
            return a.first<b.first;

        return lena>lenb;
}
};

/*void multi(ll a[2][2], ll b[2][2]){
    ll c[2][2] ;
    for(int i = 0; i<2; i++){
        for(int j = 0; j<2; j++){
            c[i][j] = a[i][j];
        }
    }

    a[0][0] = ((c[0][0]*b[0][0])%p + (c[0][1]*b[1][0])%p)%p;
    a[0][1] = ((c[0][0]*b[0][1])%p   + (c[0][1]*b[1][1])%p)%p;
    a[1][0] = ((c[1][0]*b[0][0])%p     +  (c[1][1]*b[1][0])%p)%p;
    a[1][1] = ((c[1][0]*b[0][1])%p     +  (c[1][1]*b[1][1])%p )%p;
}

ll solve(ll n){
    ll a[2][2] = {{1,1},{1,0}};
    ll b = n-1;

    ll temp[2][2] = {{-1,-1},{-1,-1}};

    while(b){
        if(b%2){
            if(temp[0][0] == -1){
                temp[0][0] = a[0][0];
                temp[0][1] = a[0][1];
                temp[1][0] = a[1][0];
                temp[1][1] = a[1][1];
            }else{
                multi(temp,a);
            }
        }
        ll te[2][2];
        te[0][0] = a[0][0];
        te[0][1] = a[0][1];
        te[1][0] = a[1][0];
        te[1][1] = a[1][1];
        multi(a,te);
        b = b/(ll)2;
    }

    return temp[0][0];
}*/

void dfs(int s, map<int,vector<int>>&adj, map<int,bool>&visited){
    visited[s] = true;
    cout<<s<<" ";
    for(auto u : adj[s]){
        if(!visited[u]){
            dfs(u,adj,visited);
        }
    }
}


int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t = 1;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n+1];

        a[0] = 0;

        for(int i = 1; i<=n; i++)
            cin>>a[i];

        sort(a,a+n+1);

        ll ans = a[n];

        ll pres[n+1] ;
        pres[1] = 0;
        for(int i = 2; i<=n; i++){
            pres[i] = a[i]+pres[i-1];
        }


        if(n == 1)
            cout<<"0"<<"\n";
        else if(n == 2){
            if(a[2]>=0)
            {
                cout<<"0"<<"\n";
            }
            else{
                cout<<a[2]<<"\n";
            }
        }
        else{
            
            for(int i = 2; i<=n; i++){
                ans -= ((ll)(i-1)*(a[i]) - pres[i-1]);
            }
            cout<<ans<<"\n";
        }
    }
    return 0;
}