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