#include using namespace std; #define reg register typedef long long ll; #define rep(i,a,b) for(reg int i=a,i##end=b;i<=i##end;++i) #define drep(i,a,b) for(reg int i=a,i##end=b;i>=i##end;--i) typedef pair Pii; typedef unsigned long long ull; typedef double db; #define mp make_pair #define pb push_back #define Mod1(x) ((x>=P)&&(x-=P)) #define Mod2(x) ((x<0)&&(x+=P)) template inline void cmin(T &a,T b){ ((a>b)&&(a=b)); } template inline void cmax(T &a,T b){ ((a T rd(){ T s=0; int f=0; while(!isdigit(IO=getchar())) if(IO=='-') f=1; do s=(s<<1)+(s<<3)+(IO^'0'); while(isdigit(IO=getchar())); return f?-s:s; } const int N=1e5+10; int a[N]; int main(){ rep(kase,1,rd()) { int n=rd(); rep(i,1,n) a[i]=rd(); sort(a+1,a+n+1); ull s=0,ans=0; rep(i,1,n) { ull x=a[i]; ans+=x*(i-1)-s; s+=x; } cout<