/*
██████╗ ██████╗ ███████╗████████╗████████╗██╗   ██╗
██╔══██╗██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝╚██╗ ██╔╝
██████╔╝██████╔╝█████╗     ██║      ██║    ╚████╔╝
██╔═══╝ ██╔══██╗██╔══╝     ██║      ██║     ╚██╔╝
██║     ██║  ██║███████╗   ██║      ██║      ██║
╚═╝     ╚═╝  ╚═╝╚══════╝   ╚═╝      ╚═╝      ╚═╝

███████╗ █████╗ ██╗   ██╗ █████╗  ██████╗ ███████╗
██╔════╝██╔══██╗██║   ██║██╔══██╗██╔════╝ ██╔════╝
███████╗███████║██║   ██║███████║██║  ███╗█████╗
╚════██║██╔══██║╚██╗ ██╔╝██╔══██║██║   ██║██╔══╝
███████║██║  ██║ ╚████╔╝ ██║  ██║╚██████╔╝███████╗
╚══════╝╚═╝  ╚═╝  ╚═══╝  ╚═╝  ╚═╝ ╚═════╝ ╚══════╝

https://www.youtube.com/watch?v=gU2HqP4NxUs
*/
#include <bits/stdc++.h>

using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#define ll                long long
#define pb                push_back
#define sz(a)             int((a).size())
#define all(c)            (c).begin(),(c).end()
#define EPS               1.0e-8
#define P(x)              cout<<#x<<" = { "<<x<<" }\n"
ll fastpow(ll base, ll power, ll M){
    if (power == 1) return base;
    ll val = fastpow(base, power / 2, M);
    return (power % 2 == 0) ? (val * val) % M : (((val * val) % M) * base) % M;
}
inline void debugMode() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
const int N = 1e5+1;
const int MOD = 1e9+7;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int main(){
    debugMode();
    int t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll arr[n + 2], pre[n + 2];
        memset(arr, 0, sizeof arr);
        memset(pre, 0, sizeof pre);
        for(int i = 1; i <= n; i++)
            cin >> arr[i];
        if(n <= 2){
            cout << 0 << endl;
            continue;
        }
        sort(arr + 1,arr + n + 1);
        for(int i = 1; i <= n; i++)
            pre[i] = arr[i];
        for(int i = n - 1; i >= 1; i--)
            pre[i] += pre[i + 1];
        ll sum = arr[n];
        for(ll i = 1; i <= n - 1; i++)
            sum -= pre[i + 1] - arr[i] * (n - i);
        cout << sum << endl;
    }
    return 0;
}