DP Problem - Birds - What's wrong with my recurrence relation ? (CF 461 Div2E)

I know my code will give TLE, I just want to know where I am wrong.
Problem: Problem - E - Codeforces

Basically this is what I did:
f(curmana,manacap,index)=max( itself, i+f(curmana- i * cst[indx]+x,manacap+b * i,indx+1) )

I have checked it for all numbers of bird for each index, hence the forloop.

//manacap is the maxmana
int f(int curmana,int manacap,int indx){
    if(indx>=n)return 0;
    if(curmana<0)return INT_MIN;
    if(curmana>manacap)curmana=manacap;
    int ans=0;
    for(int i=0;i<=bird[indx];i++){
        ans=max(ans,i+f(curmana-i*cst[indx]+x,manacap+b*i,indx+1));
    }
    return ans;
}
//ans is f(w,w,0)

You are not storing anything.
This is just plain old recursive call.

Store the results of previous calls in cache.

I know it will give TLE as mentioned, but that shouldn’t give wrong answer.