#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return;
  }
  n *= n;
  n--;
  long long ans = 0;
  long long m = 1;
  long long t = 8;
  while (n != 0) {
    n -= t;
    ans += t * m;
    t += 8;
    m++;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
