#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
  ll t;
  cin>>t;
  while(t--){
  ll n;
  cin>>n;
  ll a[n];
  for(ll i=0;i<n;i++)
   cin>>a[i];
   sort(a,a+n);
  ll sum=a[n-1];
  ll neg[n];
  neg[0]=0;
  for(ll i=1;i<n;i++)
  {
      neg[i]=neg[i-1]+i*(a[i]-a[i-1]);
      sum-=neg[i];
  }
  cout<<sum<<"\n";
  }
}