import sys import io, os input = sys.stdin.buffer.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline t = int(input()) for _ in range(t): n = int(input()) ans = (n-1)*n*(2*n-1)//6-(n-1)*n//2 ans += n*(n+1)*(2*n+1)//6-3*n*(n+1)//2+2*n print(ans)