import sys input = sys.stdin.readline T=int(input()) for t in range(T): n=int(input())-1 ans = (n*(n+1)*(2*n+1))//6-(n*(n+1))//2 print(ans*2)