#include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007; using namespace std; typedef long long ll; typedef pair Pr; ll dp[1000010][4]; int main() { int N; cin >> N; dp[0][0] = 1; for (int i = 0; i < N; i++) { for (int j = 0; j < 4; j++) { for(int k=1; k<4; k++){ if (k != j) { dp[i + k][k] += dp[i][j]; dp[i + k][k] %= mod; } } } } ll ans = 0; for (int i = 0; i < 4; i++) { ans += dp[N][i]; ans %= mod; } cout << ans << endl; return 0; }