import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class B implements Runnable {

	public static void main(String[] args) throws Exception {

		new Thread(null, new B(), "SwapnilGanguly", 1 << 24).start();
	}

	public void run() {

		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);

		int T = sc.nextInt();

		while (T-- > 0) {

			int n = sc.nextInt();
			long[] ar = new long[n];

			for (int i = 0; i < n; i++)
				ar[i] = sc.nextLong();

			sort(ar);

			int l = 0, r = n - 1;

			while (l < r) {

				long mid = (ar[l] + ar[r]) / 2;

				if ((ar[l] + ar[r]) % 2L == 0L)
					ar[l] = ar[r] = mid;

				else {

					ar[l] = mid;
					ar[r] = mid + 1;
				}

				l++;
				r--;
			}

			sort(ar);

			long[] suffix = new long[n];
			suffix[n - 1] = ar[n - 1];

			for (int i = n - 2; i >= 0; i--)
				suffix[i] = ar[i] + suffix[i + 1];

			long ans = 0L;

			for (int i = 0; i < n - 1; i++) {

				long sum = suffix[i + 1];
				long pro = ar[i] * (long)(n - i - 1);

				// System.out.println(ar[i] + " " + sum + " " + pro);

				ans += sum - pro;
			}

			pr.println(ans);

		}
		pr.close();
	}

	public static void sort(long[] a) {

		ArrayList<Long> l = new ArrayList<>();

		for (long i : a)
			l.add(i);

		Collections.sort(l);

		for (int i = 0; i < a.length; i++)
			a[i] = l.get(i);
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readArray(int n) {

			int[] ar = new int[n];

			for (int i = 0; i < n; i++)
				ar[i] = nextInt();

			return ar;
		}
	}
}
