Sereja and LCM DP Concept Doubt

Problem Statement: https://www.codechef.com/problems/SEALCM

I understood the problem but I don’t get the idea of the solution much.
My doubt is like I’m not able to decode the idea that how matrix exponentiation concept is working to find the solution?