/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    int tc;
    cin>>tc;
    while(tc--)
    {
        ll n;
        cin>>n;
        ll a[n];
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        ll ans=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]);
           ans-=neg[i];
        }
        cout<<ans<<endl;
    }

    return 0;
}
