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