Matrix Exponentiation SPOJ - SEQ

What is wrong in the code?
Showing wrong answer.

@a19JE0093,
Your code gives WA on sample test itself, you should try dry run on it.