#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; #define debug(x) cerr << #x << " = " << (x) << endl; #define mod 1000000007 //1e9+7(prime number) #define INF 1000000000 //1e9 #define LLINF 2000000000000000000LL //2e18 #define SIZE 1000100 ll power(int k,int n,int M){ if(n==0) return 1; if(n==1) return (ll)k; ll ret = power(k,n/2,M); ret=(ret*ret)%M; if(n%2==1) ret=(ret*k)%M; return ret; } ll dp[3][SIZE]; int main(){ int n; scanf("%d",&n); dp[0][0] = dp[1][0] = dp[2][0] = 1; for(int i=1;i<=n;i++){ if(i >= 1) dp[0][i] = (dp[1][i-1] + dp[2][i-1])%mod; if(i >= 2) dp[1][i] = (dp[0][i-2] + dp[2][i-2])%mod; if(i >= 3) dp[2][i] = (dp[0][i-3] + dp[1][i-3])%mod; } printf("%lld\n",(dp[0][n] + dp[1][n] + dp[2][n])%mod * power(2, mod-2, mod) % mod); return 0; }