import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Matrix { static int [][] pow(int[][] A, long n) { if(n==1) { return A; } if(n%2==0) { int[][] B = pow(A, n/2); return mul(B, B); } else { int[][] B = mul(A, pow(A, n-1)); return B; } } static int MOD = 17; static int[][] mul(int [][] A, int [][] B) { assert A[0].length == B.length; int n = A.length; int k = A[0].length; int m = B[0].length; int[][] C = new int[n][m]; for(int i=0; i