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 = 0 for i in range(n-1, 0, -1): #print(i, (n-i)*(n-i-1)) ans += (n-i)*(n-i-1) for i in range(n, 1, -1): #print(i, (i-1)*(i-2)) ans += (i-1)*(i-2) print(ans)