#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reverse_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 1e5;
int n;
llong a[mxN+3];

int main()
{
	int T = read(); while(T--)
	{
		n = read()-1;
		for(int i=0; i<=n; i++) a[i] = read();
		sort(a,a+n+1);
		llong ans = a[n]; for(int i=n; i>=1; i--) a[i] -= a[i-1];
		for(int i=1; i<=n; i++) {ans -= 1ll*i*(n+1ll-i)*a[i];}
		printf("%lld\n",ans);
	}
	return 0;
}