//undertaker
#include<bits/stdc++.h>
#define inf 1e9+7
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define fr first
#define sd second
#define pa pair<int,int>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define MEM(a) memset(a,0,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
inline int lowbit(int x){return x&(-x);}
#define N 500010
int a[N];
int main()
{
	//ios::sync_with_stdio(false);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int T=read();
	while(T--)
	{
		int n=read();FOR(i,1,n)a[i]=read();
		sort(a+1,a+n+1);
		ll s=0;
		FOR(i,1,n)s+=1LL*(i-1)*a[i];
		FOR(i,1,n)s-=1LL*(n-i)*a[i];
		s=-s;s+=a[n];cout<<s<<endl;
	}
	return 0;
}



