#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int ll;
bool cmp(const ll a,const ll b){
    return a<b? 1:0;
}

ll count (){
    int n;
    ll d[100005];
    ll count=0;
    ll sum =0;
    cin  >> n;
    for(int i=0;i< n; ++i) cin >> d[i];
    
    if(n==1) return 0;

    sort(d,d+n,cmp);

    for(int i=0;i<n-1;++i){
        sum += d[i];
        count += sum - d[i+1]*(i+1);
    }

    count += d[n-1];
    return count;
    
}

int main(){
    int t;
    cin >> t;
    while (t--)
    {
        cout << count() << endl ;
    }
    
}