T = int(input()) def f(n): return 2*n*(n - 1)*(n - 2)//3 for i in range(T): N = int(input()) print(f(N))