#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
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;
}