import math T = int(input()) qs = [int(input()) for _ in range(T)] s = 2 tmp = 0 mq = max(qs) s = [] for j in range(3, mq+1): p = math.factorial(j-1) // math.factorial(j-3) s.append(p*2) for q in qs: print(sum(s[:q-2]))