using System; using System.Collections.Generic; //No314 ケンケンパ class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("3"); //2 } else if (InputPattern == "Input2") { WillReturn.Add("4"); //3 } else if (InputPattern == "Input3") { WillReturn.Add("100"); //831891005 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { const long Hou = 1000000007; List InputList = GetInputList(); int N = int.Parse(InputList[0]); //場合の数[連続したケンの数]なDP表 int UB = 2; long[] PrevDP = new long[UB + 1]; PrevDP[0] = 1; for (int I = 1; I <= N; I++) { long[] CurrDP = new long[UB + 1]; for (int J = 0; J <= UB; J++) { if (PrevDP[J] == 0) continue; //パにする場合 if (J > 0) { CurrDP[0] += PrevDP[J]; CurrDP[0] %= Hou; } //ケンを続ける場合 if (J < 2) { CurrDP[J + 1] += PrevDP[J]; CurrDP[0] %= Hou; } } PrevDP = CurrDP; } long Answer = 0; foreach (long EachLong in PrevDP) { Answer += EachLong; Answer %= Hou; } Console.WriteLine(Answer); } }