#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define int int64_t

void run(){
    int n; cin >> n;
    vector<int>v(n);
    rep(i,0,n){
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    int csum = 0;
    int sum = 0;
    rep(i,2,n){
        sum += v[i-2];
        csum -= (v[i]*(i-1));csum += sum;
    }
    cout << csum << '\n';
}

int32_t main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin.exceptions(cin.failbit);

    int tests = 1;
    cin >> tests;

    while (tests-- > 0) 
        run();

}
