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