#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        vector<int> d(n);
        for (int i = 0; i < n; i++){
            cin >> d[i];
        }
        sort(d.begin(), d.end());
        long long ans = 0;
        long long sum = 0;
        for (int i = 0; i < n; i++){
            ans -= (long long)i * d[i] - sum;
            sum += d[i];
        }
        ans += *max_element(d.begin(), d.end());
        cout << ans << "\n";
    }
}
