using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Program { static void Main() { new Magatro().Solve(); } } class Magatro { private int N; private const int Mod = (int)1e9 + 7; public void Solve() { N = int.Parse(Console.ReadLine()); var dp = new long[N + 10, 4]; dp[0, 0] = 1; for (int i = 0; i < N; i++) { if (i == 0) { dp[i + 1, 1] = dp[i, 0]; dp[i + 2, 2] = dp[i, 0]; dp[i + 3, 3] = dp[i, 0]; } else { if (dp[i, 1] != 0) { dp[i + 2, 2] += dp[i, 1]; dp[i + 3, 3] += dp[i, 1]; } if (dp[i, 2] != 0) { dp[i + 3, 3] += dp[i, 2]; dp[i + 1, 1] += dp[i, 2]; } if (dp[i, 3] != 0) { dp[i + 1, 1] += dp[i, 3]; dp[i + 2, 2] += dp[i, 3]; } } dp[i + 1, 1] %= Mod; dp[i + 4, 2] %= Mod; dp[i + 3, 3] %= Mod; } Console.WriteLine((dp[N, 1] + dp[N, 2] + dp[N, 3]) % Mod); } }