Number of coins
With an unlimited supply of each coin, every call either takes the current coin — and stays on it, so it can be taken again — or moves past it. -1 marks a sum that can't be made, and dp[requiredSum][coinIndex] remembers every answer. In the tree a box shows requiredSum, a jar of what is still to make, and the coin in use; on the way back a take that worked adds +1, and a coin marks every call that returns a count.