#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        vector<long long> a(n);
        for (int i = 0; i < n; ++i){
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        long long ans = 0;
        for (int k = 1; k < n; ++k){
            ans += a[k] * (2 * k + 1 - n);
        }
        ans -= a[n-1];
        
        cout << -ans << endl;
    }
}