#include #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(a, b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define show(x) cout <<#x<<" = "<<(x)<P; const int MAX_N = 1000005; ll dp[MAX_N][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; for(int i=4;i<=n;i++){ dp[i][0] = (dp[i-1][1] + dp[i-1][2]) % MOD; dp[i][1] = (dp[i-2][0] + dp[i-2][2]) % MOD; dp[i][2] = (dp[i-3][0] + dp[i-3][1]) % MOD; } cout << (dp[n][0] + dp[n][1] + dp[n][2]) % MOD << endl; return 0; }