#include #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; ll MOD = 1e9 + 7; ll dp[n+5][4]; rep(i, n+5) rep(j, 4) dp[i][j] = 0; dp[1][1] = dp[2][2] = dp[3][3] = 1; for(int i = 1; i <= n; i++){ for(int j = 1; j <= 3; j++){ if(j != 1) {dp[i+j][j] += dp[i][1]; dp[i+j][j] %= MOD;} if(j != 2) {dp[i+j][j] += dp[i][2]; dp[i+j][j] %= MOD;} if(j != 3) {dp[i+j][j] += dp[i][3]; dp[i+j][j] %= MOD;} } } cout << (dp[n][1] + dp[n][2] + dp[n][3]) % MOD << endl; }