#include <bits/stdc++.h>
#include <time.h>
using namespace std;

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define endl "\n"
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define db4(x,y,z,k) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<"\t"<<#k<<" : "<<k<<endl;

int main()
{
    IOS;
    ll t,n,m,k,u,v,x,y;
    t=1;
    cin >> t;
    while(t--)
    {
        cin >> n;
        vector<ll> a(n);
        for(int i=0;i<n;i++)
            cin >> a[i];
        sort(all(a));
        ll ans = 0;
        for(int i=1;i<n;i++)
        {
            m = i;
            ans -= m*a[i];
            k = (n-i-1);
            ans += k*a[i];
        }
        ans += a[n-1];
        cout << ans << endl;
    }
    return 0;
}
