#include using namespace std; const int MAX_N = 1000000; const int iMod = 1000000007; long long Step1[ MAX_N + 5 ]; long long Step2[ MAX_N + 5 ]; long long Step3[ MAX_N + 5 ]; int main( int argc, char *argv[] ) { int i; int N; long long iAns; ios::sync_with_stdio( false ); cin.tie( 0 ); cin >> N; Step1[ 1 ] = 1; Step2[ 2 ] = 1; Step3[ 3 ] = 1; for( i = 1; i < N; i++ ) { Step1[ i + 1 ] += Step2[ i ]; Step1[ i + 1 ] += Step3[ i ]; Step2[ i + 2 ] += Step1[ i ]; Step2[ i + 2 ] += Step3[ i ]; Step3[ i + 3 ] += Step1[ i ]; Step3[ i + 3 ] += Step2[ i ]; Step1[ i + 1 ] %= iMod; Step2[ i + 2 ] %= iMod; Step3[ i + 3 ] %= iMod; } iAns = Step1[ N ] + Step2[ N ] + Step3[ N ]; iAns %= iMod; cout << iAns << endl; return 0; }