using System.Numerics; public class Program { public static void Main() { //BigInteger num = BigInteger.Parse(Console.ReadLine() ?? string.Empty); int num = int.Parse(Console.ReadLine() ?? string.Empty); //string[] moji = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); //string str = Console.ReadLine() ?? string.Empty; List list = new List(); KENPA(list, "", 0,num,0); double d = Math.Pow(10, 9); int aa = (int)(list.Count % (d + 7)); Console.WriteLine(aa); } static void KENPA(List list, string box, int index,int num,int youso) { if(youso ==num) { list.Add(box); return; } string[] strings = { "ケン", "パ"}; for(int i = 0; i < strings.Length; i++) { int yy = youso; string a = box; if(a==""&&i ==1) { return; } if(a!="") { if(a[a.Length - 1] == 'パ' && i == 1) { continue; } if(a.Length >=4) { if (a.Substring(a.Length - 4) == "ケンケン" && i == 0) { continue; } } } KENPA(list, a + strings[i], i, num, yy+1); } } }