from itertools import accumulate from math import factorial T = int(input()) qs = [int(input()) for _ in range(T)] mq = max(qs) s = [] for j in range(3, mq+1): p = (j-1) * (j-2) s.append(p*2) accum_s = list(accumulate(s)) for q in qs: print(accum_s[q-3])