S E Q - matrix exponentiation maths help?

sfsdgfdgfdgfsdgfdhfgh …

My solution is failing at last test case , any hint why it is so.
??