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