#include int main() { int i, t, T, N; long long ans[1000001] = {}; for (N = 3, ans[2] = 0, ans[1] = 0; N <= 1000000; N++) ans[N] = ans[N-1] + (long long)(N - 1) * (N - 2); scanf("%d", &T); for (t = 1; t <= T; t++) { scanf("%d", &N); printf("%lld\n", ans[N] * 2); } fflush(stdout); return 0; }