Regarding error in code

Hey , I tried solving the ladders problem using matrix exponentiation and am facing some problems with my code as the answers are not coming out to be correct . KIndly help me with the code

https://ide.codingblocks.com/s/322067 link to the code

Please look at this and compare the differences.

Try to see what was wrong, if you have any doubts, ask me.