n = int(input()) for _ in range(n): k = int(input()) print(int(2*(k*(k-1)*(k-1)-k*(k-1))/3))