#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e15;
const ll NINF = -INF;
const int mod = 1e9+7;
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define vi vector<int>
#define f first
#define s second
#define all(a) a.begin(),a.end()
#define sortv(v)   sort(all(v))   
#define revv(v) reverse(all(v))   
#define nline cout<<"\n"

void solve()
{
    int n;
    cin>>n;
    ll a[n+1],i;
    rep(i,1,n+1)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    
    ll ans =0;
    int temp = n-1;
    // a[5]*3 + a[4]*2 + a[3]
    for(i=n;i>=3;i--)
    {
        ans+=a[i]*(i-2);
    }
    for(i=n-2;i>=1;i--)
    {
        ans-=(a[i]*(temp-i));
    }
    cout<<-ans<<endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
        solve();
    }
}