#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll t,n;
cin>>t;
while(t--){
cin>>n;
ll ans=0;
for(int i=0;i<n;i++){
ans+=i*n+(i+1);
}
cout<<ans<<"\n";
}
return 0;
}