#include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl
#define all(v) v.begin(), v.end()
#define fo(i, n) for (int i = 0; i < n; i++)
#define fok(i, k, n) for (int i = k; i < n; i++)
#define pb push_back
#define FLASH ios_base::sync_with_stdio(false), cin.tie(NULL);
#define float long double
using namespace std;

void solve()
{
   ll i = 0, j = 0, k = 0;
   int n;
   cin >> n;
   ll a[n];
   for (int i = 0; i < n; i++)
   {
      cin >> a[i];
   }
   sort(a, a + n);
   ll ans = 0;
   ll pre = a[0];
   // cout << ans << "\n";

   fok(i, 1, n)
   {
      ans += pre - (i)*a[i];
      pre = pre + a[i];
   }
   cout << ans + a[n - 1] << "\n";
}

signed main()
{
   FLASH
#ifndef ONLINE_JUDGE
   freopen("output.txt", "w", stdout);
   freopen("input.txt", "r", stdin);
#endif
   int t;
   cin >> t;
   while (t-- > 0)
   {
      solve();
   }
   return 0;
}