#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  long long int n;
  cin >> t;
  while (t--) {
    long long int ans;
    cin >> n;
    ans = ((pow(n, 2) - 1) * n) / 3;
    cout << ans << endl;
  }
}
