#include using namespace std; typedef long long ll; ll MOD = 1e9 + 7; ll dp[(int)1e6+10][4]; int main(void) { ll N; cin >> N; dp[1][1] = 1; dp[2][2] = 1; dp[3][1] = 1; dp[3][2] = 1; dp[3][3] = 1; for (int i = 4; i <= N; i++) { dp[i][1] = (dp[i-1][2] + dp[i-1][3]) % MOD; dp[i][2] = (dp[i-2][1] + dp[i-2][3]) % MOD; dp[i][3] = (dp[i-3][1] + dp[i-3][2]) % MOD; } cout << ( dp[N][1] + dp[N][2] + dp[N][3] ) % MOD << endl; return 0; }