#include<iostream>
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 sum = n * (n + 1) / 2 + n * (n * (n - 1) / 2);
cout <<sum << endl;
}
return 0;
}