from sys import stdin t, *a = map(int, stdin.read().split()) for i in range(t): n = a[i] - 1 ans = n * (n+1) * (2*n+1) // 6 ans -= n * (n+1) // 2 ans *= 2 print("{}".format(ans))