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