#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include <stack>
#include <iomanip>
#include <assert.h>
#include <bitset>
//#include "cycle.h"
using namespace std;
#define ll long long
//cin.tie(0);ios_base::sync_with_stdio(0);

void solve() {
	int n;
	cin >> n;
	vector<ll> nums;
	for (int i = 0; i < n; i++) {
		int temp;
		cin >> temp;
		nums.push_back(temp);
	}
	sort(nums.begin(), nums.end());
	ll sum = nums[0];
	ll ans = 0;
	for (int i = 2; i < n; i++) {
		ll cur = nums[i] * (i - 1);
		ans += (cur - sum);
		sum += nums[i - 1];
	}
	ans = ans * -1;
	cout << ans << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
}