#include <iostream>
#include<algorithm>
#include <cmath>
using namespace std;
int main() {
long long int t;
cin >> t;
long long int n;
for (int i = 1; i <= t; i++) {
cin >> n;
long long int sum = 1;
int k =n*n;
for (int j = 1; j < n; j++)
{
sum = sum +k;
k = k-n-1;
}
cout << sum << endl;
}
return 0;
}