#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <ctime>

using namespace std;

void solve(int tcase) {
	int n;
	cin >> n;
	vector<long long> d(n);
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}

	sort(d.begin(), d.end());

	long long res = d.back();

	long long csum = 0;
	for (int i = 1; i < n; ++i) {
		res -= d[i] * i;
		res += csum;
		csum += d[i];
	}
	cout << res << "\n";
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	//t = 1;


	for (int tt = 0; tt < t; ++tt) {
		solve(tt + 1);
	}




	return 0;

}