import sys input = sys.stdin.readline T=int(input()) for tests in range(T): N=int(input()) print(N*(N-1)*(N-2)*2//3)