Powers of square matrices

Write a program that, given a square matrix MM and a natural number nn, computes MnM^n.

Input

The input consists of several cases. Each case consists of a natural number n0n \geq 0 followed by a natural number m>0m > 0 and by m×mm \times m integer numbers.

Output

For each case, print the elements of MnM^n in mm lines following the format of the example. Print a line with 10 dashes after every matrix.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T15:51:41.384Z

© Jutge.org, 2006–2026.
https://jutge.org