Matrix Exponentation

PROBLEM LINK :- https://www.spoj.com/problems/SEQ/
PROBLEM CODE :- https://ide.codingblocks.com/s/50933

I am getting runtime error.I have commented out the code for reference