#include<bits/stdc++.h>
#include<string>
using namespace std;
#define int long long 
#define pb push_back
#define test int t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define primee 1500450271
#define mod 1000000007
void arrin(int a[],int n)
{
    for(int i=0;i<n;i++)
    cin>>a[i];
}
void arrout(int a[],int n)
{
    for(int i=0;i<n;i++)
    cout<<a[i]<<" ";
}
bool is_prime(int n)
{
    if(n==1)
    return false;
    if(n==2||n==3)
    return true;
    else if(n%2==0||n%3==0)
    return false;
    for(int i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)
        return 0;
    }
    return 1;
}
signed main()
{
    test
    {
        int n;
         cin>>n;
         int a[n];
         arrin(a,n);
         sort(a,a+n);
         int ans=0,p=0;
  	     for(int i=2;i<n;i++)
  	     {
  	         p=p+a[i-2];
  	         ans=ans-(a[i]*(i-1));
  	         ans+=p;
  	     }
  	     cout<<ans<<endl;
    }
}