#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <sstream>
#include <list>
#include <map>
#include <set>
#include <limits>
#include <random>
#include <functional>
#include <unordered_set>
#include <unordered_map>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>

using namespace std;

const int N = 1010;
const int M = 50010;
const int MOD = 1000000007;
const int INF = 1000090999;
const ll LINF = (1ll << 60) + 1337;
const ld EPS = 0.00000001;

void print_arr(vl& a) {
    for (auto& i : a) cout << i << " ";
    cout << "\n";
}

void dbg_cnt(int n) {
    vl cnt(n);
    for (int d = 1; d <= n; d++) {
        for (int i = 0; i + d <= n; i++) {
            for (int j = i; j < i + d; j++) {
                cnt[j]++;
            }
        }
    }
    print_arr(cnt);
}



int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef _DEBUG
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vl a(n), cnt(n - 1);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        for (int i = 0; i + 1 < n; i++) {
            a[i] = a[i + 1] - a[i];
        }
        a.resize(n - 1);
        //print_arr(a);
        n = a.size();
        if (n <= 0) {
            cout << 0 << "\n";
            continue;
        }
        //dbg_cnt(n);
        if (n % 2) {
            ll delta = 1;
            for (int i = n / 2; i >= 0; i--) {
                cnt[i] = delta;
                delta += 2;
            }
            delta = 1;
            for (int i = n / 2 + 1; i < n; i++) {
                cnt[i] = -delta;
                delta += 2;
            }
        }
        else {
            ll delta = 0;
            for (int i = n / 2; i >= 0; i--) {
                cnt[i] = delta;
                delta += 2;
            }
            delta = 0;
            for (int i = n / 2; i < n; i++) {
                cnt[i] = -delta;
                delta += 2;
            }
        }
        //print_arr(cnt);
        ll cur = n;
        cnt[0] = 0;
        for (int i = 0; i < n; i++) {
            cur += cnt[i];
            cnt[i] = cur;
        }
        //print_arr(cnt);
        ll ans = 0;
        for (int i = 0; i < n; i++) {
            ans += (-1) * cnt[i] * a[i] + a[i];
        }
        cout << ans << "\n";
    }
}

/*
    Important stuff
    - int overflow
    - array bounds
    - special cases (n=1, max n) maybe adhoc problem
    - doubles are read for a long time (4 * 10 ^ 5 danger GNU vs MS ICPC 2020 1/4)
    - don't get stuck on one approach
    - don't get stuck on one problem
    - recheck submissions if near the end of the tournament and there is nothing to do
    - do something instead of nothing and stay organized
*/