#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) //方針 //動的計画法dp[連続したケンの数][最後がパかどうか] //最後がパになる = けんぱorけんけんぱ //けんがi回続く = ぱ->けんorけん->けん //dp[i][0] = d[0][1] + dp[i-1][0] //初期はdp[1][0] = 1 int main(){ ll MOD = pow(10, 9) + 7; int N; cin >> N; ll dp[3][2]; FOR(i, 0, 3) FOR(j, 0, 2) dp[i][j] = 0; dp[1][0] = 1; ll a, b, c; FOR(i, 1, N){ a = (dp[1][0] + dp[2][0]) % MOD; b = dp[0][1] % MOD; c = dp[1][0] % MOD; dp[0][1] = a; dp[1][0] = b; dp[2][0] = c; } ll ans = 0; ans += (dp[0][1] + dp[1][0] + dp[2][0]) % MOD; cout << ans << endl; }