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