for i in range(int(input())): N = int(input()) ans = 0 for i in range(1, N + 1): ans += (N - i) * (N - i - 1) ans += (i - 1) * (i - 2) print(ans)