#include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (ll i = (a); i < (b); i++) #define REP(i,n) FOR(i,0,n) long gcd(long a, long b){ if (a%b==0){ return b; } else{ return gcd(b,a%b); } } long lcm(long a, long b){ return (a*b) / gcd(a,b); } template inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; } typedef long long ll; const ll INF = 1ll<<29; const ll MOD = 1000000007; const double EPS = 1e-10; ll c[1000001][3]; int main(){ ll n; cin >> n; c[0][0] = 0; c[0][1] = 0; c[0][2] = 0; c[1][0] = 1; c[1][1] = 0; c[1][2] = 0; c[2][0] = 0; c[2][1] = 1; c[2][2] = 0; c[3][0] = 1; c[3][1] = 1; c[3][2] = 1; FOR(i,4,n+1){ c[i][0] = (c[i-1][1] + c[i-1][2])%MOD; c[i][1] = (c[i-2][0] + c[i-2][2])%MOD; c[i][2] = (c[i-3][0] + c[i-3][1])%MOD; } printf("%lld\n", (c[n][0]+c[n][1]+c[n][2])%MOD); return 0; }