#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long dp[500005] = {0};
    dp[3] = 8;
    long long fac = 2;
    for (long long i = 5; i <= 500000; i += 2) {
      dp[i] = dp[i - 2] + fac * (i + i + i - 2 + i - 2);
      ++fac;
    }
    cout << dp[n] << endl;
  }
}
