1.
/**
* Angewandte Mathematik, SS11
* Problem: 11554 Hapless Hedonism
* Link: http://mathworld.wolfram.com/TriangleCounting.html
*
* @author Schramm, Felix
* @author Vogel, Johannes
* @version 1.0, 06/27/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.236
*/

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
StringBuffer output = new StringBuffer();
int cases = input.nextInt();
long sticks = 0;
long triangles = 0;
for (int i=0;i<cases;i++) {
sticks = input.nextInt();
if (sticks%2==0)
triangles = (sticks*(sticks-2)*(2*sticks-5))/24;
else
triangles = ((sticks-1)*(sticks-3)*(2*sticks-1))/24;

output.append(triangles);
if (!(i+1==cases))
output.append("\n");
}
System.out.println(output);
}

}