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