#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(0);
cout.tie(0); cout.tie(0);
int tt;
cin >> tt;
while(tt--)
{
ll n;
cin >> n;
cout << n + (n * (n - 1) / 2) * (n + 1) << '\n';
}
return 0;
}