#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; ll dp[1010101][3]; int main() { int n; cin >> n; dp[1][0] = 1; dp[2][1] = 1; dp[3][0] = 1; dp[3][1] = 1; dp[3][2] = 1; rep(i, 4, n + 1) { dp[i][0] = dp[i - 1][1] + dp[i - 1][2]; dp[i][1] = dp[i - 2][0] + dp[i - 2][2]; dp[i][2] = dp[i - 3][0] + dp[i - 3][1]; dp[i][0] %= MOD; dp[i][1] %= MOD; dp[i][2] %= MOD; } cout << (dp[n][0] + dp[n][1] + dp[n][2]) % MOD << endl; return 0; }