T = int(input()) for i in range(T): N = int(input()) k=0 k = int(N*(N-1)*(N-2)*2/3) print(k)