#include <iostream>
using namespace std;
int main(void)
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int a,b,sum;
while(true)
{
cin>>a;
if(a==0)
break;
sum=0;
for(b=1;b<=a;b++)
sum+=b*b;
cout<<sum<<"\n";
}
return 0;
}