#include <bits/stdc++.h>
#define ll long long
#define f(n) for(ll i=0;i<n;i++)
#define mod 998244353
#define vl vector<ll>
#define pb push_back
#define mk make_pair
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define nl "\n"
#define IOS ios_base::sync_with_stdio(false);
 
#include <iostream>
using namespace std;
 

void solve()
{
        ll n;
        cin>>n;
        ll a[n];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        ll v=0,s=0;
 
        for(int i=2;i<n;i++)
        {
            s+=a[i-2];
            v-=(a[i]*(i-1));
            v+=s;
        }
        cout<<v<<endl;
}
 

void init_code()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
}
 
 
int main()
{
    init_code();
   IOS
   cin.tie(NULL);
   cout.tie(NULL);
   ll t;
   cin>>t;
   //t=1;
   while(t--)
   {
      solve();
   }
   return 0;
}