//
//  main.cpp
//  这里可以说点什么呢
//
//  Created by 邓思航 on 2021/4/1.
//
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
const int P = 1e9 + 7;
const int maxn =1e5 + 10;
const int maxm = 5e5 + 10;
const int inf = 1e9;
string s;
ll a[maxn];
int vec[710][710];
int ri[710][710], le[710][710];
int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b);
}
void solve() {
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + n + 1);
    ll ans = 0;
    for(int i = 2; i <= n - 1; i++) {
        ans = ans - a[i] * (i - 1 - n + i);
    }
    ans = ans - a[n] * (n-2);
    cout << ans << endl;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;cin >> t;while(t--)
    solve();
    return 0;
}
    
