#include<bits/stdc++.h>
using namespace std;
int f(int n)
{
int r=0;
if(n==1)
{
r=1;
}
else
{
r=f(n-1)+n-1;
}
return r;
}
int main()
{
int s=0;
int i=1;
while(s<5000)
{
s=s+f(i);
i=i+1;
}
cout<<s;
return 0;
}
/**************************************************************
Problem: 1146
User: chenkexin
Language: C++
Result: Accepted
Time:4 ms
Memory:2072 kb
****************************************************************/