#include #include #include #include #include #include #include #include #include #include #include #include #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 #define INF 1000000000 using namespace std; long long int dp[3][1000001] = {}; int main(void) { int n; long long int total = 0; cin >> n; dp[0][1] = 0; dp[1][1] = 1; dp[2][1] = 0; FOR(i, 2, n) { dp[0][i] = dp[1][i - 1] + dp[2][i - 1]; dp[1][i] = dp[0][i - 1]; dp[2][i] = dp[1][i - 1]; if (dp[0][i] > MOD) { dp[0][i] %= MOD; } if (dp[1][i] > MOD) { dp[1][i] %= MOD; } if (dp[2][i] > MOD) { dp[2][i] %= MOD; } } total = dp[0][n] + dp[1][n] + dp[2][n]; if (total > MOD) { total %= MOD; } cout << total << endl; return 0; }