T = int(input()) for _ in range(T): N = int(input()) print(N * (N - 1) * (N - 2) //6 * 4)