Sponsored
Use these hints if you're stuck. Try solving on your own first.
Model the problem as a matrix multiplication problem.
Use exponentiation to quickly multiply matrices.
Solve with full IDE support and test cases