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