#include <bits/stdc++.h>
using namespace std;

#define PI 3.141592653589793238462643383279
int mod = 1e9+7;

int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        long long res = 0;
        vector<int> v;
        for (int i = 0;i < n; ++i){
            int k;
            cin>>k;
            v.push_back(k);
        }
        sort(v.begin(), v.end());
        for (int i = 1; i < n; ++i){
            res += 1LL*v[i]*(2*i-n+1);
        }
        res -= v[n-1];
        res= -res;
        cout<<res<<endl;
    }
}
