#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>

int main()
{
    int t;
    std::cin >> t;
    for (int test = 0; test < t; ++test) {
        int n;
        std::cin >> n;
        std::vector<long long> d(n);
        for (int i = 0; i < n; ++i) {
            std::cin >> d[i];
        }
        std::sort(d.begin(), d.end());
        long long ans = 0;
        long long pref_sum = 0;
        for (int i = 1; i < n; ++i) {
            ans += i * d[i] - pref_sum - d[i] + d[i - 1];
            pref_sum += d[i];
        }
        std::cout << -ans << std::endl;
    }
}