How to form the recursion tree for this type of problems ?

I am trying to solve this problem on topcoder.I read the editorial but I am not able to get the recurrence.Can any please help in finding the recursion tree for this type of problems.