#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[33], b[33];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n / 2; i++) ans += 1LL * (2 * i - 1) * (i - 1) + i;
    ans = ans * 4 + (1LL * n * n - n - n + 1);
    cout << ans << endl;
  }
  return 0;
}
