import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int t= sc.nextInt();

		long[] x = new long[1000001];
		for (int i = 1; i < x.length; i++) {
			x[i] = (long) i * (i + 1) + x[i - 1];
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			int n = sc.nextInt();

			pw.println(x[n - 2] * 2);
		}
		pw.flush();
		sc.close();
	}
}