#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, sum = 0;
    cin >> n;
    for (long long int i = n; i >= 4; i--) {
      sum = sum + (i * (i - 1));
    }
    if (n == 1)
      cout << "0" << endl;
    else
      cout << sum + 8 << endl;
  }
  return 0;
}
