#include<bits/stdc++.h>
using namespace std;
void solve()
{
    int n;cin>>n;
    vector<long long> v(n);
    for(int i = 0; i<n; i++)
    {
        cin>>v[i];
    }
    sort(v.begin(), v.end());
    if(n==1)
    {
        cout<<0<<endl;
    }
    else
    {
        vector<long long> diff(n);
        for(int i = 0; i<n-1; i++)
        {
            diff[i] = v[i+1] - v[i];
        }
 
        long long ans = 0;
 
        for(int i = 0; i<n-1; i++)
        {
            ans-= (diff[i]*(i+1)*(n-1-i));
        }
        cout<<ans + accumulate(diff.begin(),diff.end(),0)<<endl;
    }
 
 
 
 
}
int main()
{
    int tc;cin>>tc; while(tc--)
    solve();
}