#include // {{{ Definitions #define reg register #define pr std::pair #define fi first #define se second #define FIN(s) freopen(s, "r", stdin) #define FOUT(s) freopen(s, "w", stdout) #define FERR(s) freopen(s, "w", stderr) #define debug(...) fprintf(stderr, __VA_ARGS__) #define dputs(s) fprintf(stderr, s"\n") #define rep(i, l, r) for (int i = l; i <= r; ++i) #define lep(i, l, r) for (int i = l; i < r; ++i) #define irep(i, r, l) for (int i = r; i >= l; --i) #define ilep(i, r, l) for (int i = r; i > l; --i) #define Rep(i, n) rep(i, 1, n) #define Lep(i, n) lep(i, 1, n) #define IRep(i, n) irep(i, n, 1) #define ILep(i, n) ilep(i, n, 1) typedef unsigned long long ll; typedef long double ld; // }}} // {{{ Modular namespace modular { const int MOD = 1000000007; inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; } inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; } inline int mul(int x, int y) { return 1LL * x * y % MOD; } inline int qpow(int x, int y) { int ans = 1; for (; y; y >>= 1, x = mul(x, x)) if (y & 1) ans = mul(ans, x); return ans; } }; // namespace modular // }}} // {{{ Base namespace Base { template inline Tp input() { Tp x = 0, y = 1; char c = getchar(); while ((c < '0' || '9' < c) && c != EOF) { if (c == '-') y = -1; c = getchar(); } if (c == EOF) return 0; while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar(); return x *= y; } template inline void read(Tp &x) { x = input(); } template inline void chmax(Tp &x, Tp y) { x < y ? x = y : 0; } template inline void chmin(Tp &x, Tp y) { x > y ? x = y : 0; } }; // namespace Base // }}} using namespace Base; #define MAX_N 200007 int N; ll a[MAX_N]; void solve() { read(N); Rep(i, N) read(a[i]); std::sort(a + 1, a + N + 1); ll ans = 0, sum = 0; Rep(i, N) { ans += (ll)1 * (i - 1) * a[i] - sum; sum += a[i]; } printf("%lld\n", ans); } int main() { #ifndef ONLINE_JUDGE FIN("a.in"); // FOUT("a.out"); // FERR("a.log"); #endif int T = input(); while (T--) solve(); return 0; }