def solve(): N = int(input()) N -= 2 print(2 * N * (N + 1) * (N + 2) // 3) return T = int(input()) for _ in range(T): solve()