#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll MOD = 1000000007; int main() { int N; cin >> N; ll dp[N + 4][4]; memset(dp, 0, sizeof(dp)); dp[1][1] = 1; dp[2][2] = 1; dp[3][3] = 1; for (int i = 0; i < N; ++i) { for (int j = 1; j <= 3; ++j) { switch(j) { case 1: dp[i + 2][2] += dp[i][1]; dp[i + 3][3] += dp[i][1]; dp[i + 2][2] %= MOD; dp[i + 3][3] %= MOD; break; case 2: dp[i + 1][1] += dp[i][2]; dp[i + 3][3] += dp[i][2]; dp[i + 1][1] %= MOD; dp[i + 3][3] %= MOD; break; case 3: dp[i + 1][1] += dp[i][3]; dp[i + 2][2] += dp[i][3]; dp[i + 1][1] %= MOD; dp[i + 2][2] %= MOD; break; } } } cout << (dp[N][1] + dp[N][2] + dp[N][3]) % MOD << endl; return 0; }