using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ const long mod = (long) 1e9 + 7; public void Solve(){ if(N == 1){ Console.WriteLine(2); return; } // B * A^(N-1) * v; int NN = 1 << 6; EdgeA = new bool[NN,NN]; EdgeB = new bool[NN,NN]; tot = 0; int[] ar = new int[H * W]; dfs(ar, 0 , 1); //Console.WriteLine(tot); long[][] e0 = new long[NN][]; for(int i=0;i 0){ if((k & 1) == 1){ ret *= x; } x *= x; k>>=1; } var C = B * ret; var Cv = C * v; long ans = Cv.Sum() % mod; if(ans < 0) ans += mod; Console.WriteLine(ans); } bool[,] EdgeA; bool[,] EdgeB; int tot; int H = 3, W = 7; void dfs(int[] ar, int now, int cnt){ if(now == H * W){ bool chk = true; for(int i=0;iint.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} } class Mat{ const int N = 1<<6; long[][] m; const long mod = (long) 1e9 + 7; public Mat(){ m = new long[N][]; for(int i=0;i