#include <bits/stdc++.h>
using namespace std;
int main(){
    int s=0,h=1,g=1,i;
    for(i=1;s<=5000;i++){
        s+=g;
        h+=i;
        g=h;
    }
    cout<<s;
}
/**************************************************************
	Problem: 1146
	User: linzihang
	Language: C++
	Result: Accepted
	Time:11 ms
	Memory:2072 kb
****************************************************************/