#include <bits/stdc++.h>
const int maxn = 1e6 + 7;
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = 3.1415926535897932384626433832795;
long long f[maxn];
int main() {
  f[1] = 0;
  f[3] = 8;
  for (long long i = 5; i <= 5e5; i += 2)
    f[i] = (i * 4 - 4) * (i / 2) + f[i - 2];
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    printf("%lld\n", f[n]);
  }
  return 0;
}
