hey there.I am a beginner and i am learning recursion these days.

I came across with this problem.And i am having some queries.

#include <bits stdc++.h>

using namespace std;

int rodCutting(int n, int a, int b, int c)

{

if(n == 0)

return 0;

if(n < 0)

return -1;

int res = max(max(rodCutting(n-a, a, b, c), rodCutting(n-b, a, b, c)),

rodCutting(n-c, a, b, c));

if(res== -1)

return -1;

return 1+res;

}

int main()

{

int n = 25;

int a = 11, b = 12, c = 13;

cout << rodCutting(n, a, b, c);

}

please explain me how return res+1 is working.I mean we are initializing it again and again how it is incrementing its value??? Please help!!!