from scipy.special import perm T = int(input()) qs = [int(input()) for _ in range(T)] mq = max(qs) s = [] for j in range(3, mq+1): p = perm(j, 2, exact=True) s.append(p*2) for q in qs: print(sum(s[:q-2]))