#include <iostream>   #include <vector>   #include <algorithm>      using namespace std;      #define int long long      void solve() {       int n;       vector<long long> vect;       cin >> n;       for (int i = 0; i < n; i++) {           long long x;           cin >> x;           vect.push_back(x);       }       sort(vect.begin(), vect.end());       long long res = 0;       long long now = 0;       for (int i = n - 2; i >= 0; i--) {           res -= now - (n - i - 2) * vect[i];           now += vect[i + 1];       }       cout << res <<   n ;   }      signed main()   {       ios_base::sync_with_stdio(false);       cin.tie(nullptr);       int t;       cin >> t;       for (int i = 0; i < t; i++)           solve();       return 0;   }   