Matrix exp in NP ladder problem with snakes

in NP ladder problem how to use matrix exp if snakes are there on few steps. is it not cumpulsory to use recurssion then.

Hey @yash_jjw
Where did you face this problem with snakes on ladder ?