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