#include <bits/stdc++.h>
using namespace std;
vector<long long> V, L, Q;
vector<string> P;
map<int, int> M;
set<char> S;
set<char>::iterator it;
long long n, m, a, b, c, d, e, f, cnt, x, y, z, t;
string s, p, ans, temp;
long long arr[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool xy = 0;
char bd;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a;
  for (int j = 0; j < a; j++) {
    cin >> n;
    for (int i = 1; n > 0; i++) {
      cnt += (i * (n - 1) * 2);
      n--;
    }
    cout << cnt << endl;
    cnt = 0;
  }
}
