#include #include #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using ll = long long; template using V = vector; template using VV = V >; const ll mod = 1000000007; ll powmod(ll x, ll n) { ll res = 1; while (n > 0) { if (n & 1) { res = res * x % mod; } x = x * x % mod; n >>= 1; } return res; } int main(void) { int n; cin >> n; if (n <= 3) { cout << 0 << endl; return 0; } V dp(8, 1); rep(i, 3, n) { V ndp(8); ndp[0] = (dp[0] + dp[4]) % mod; ndp[1] = (dp[0] + dp[4]) % mod; ndp[2] = dp[1]; ndp[3] = (dp[1] + dp[5]) % mod; ndp[4] = (dp[2] + dp[6]) % mod; ndp[5] = (dp[2] + dp[6]) % mod; ndp[6] = (dp[3] + dp[7]) % mod; ndp[7] = (dp[3] + dp[7]) % mod; rep(j, 0, 8) { dp[j] = ndp[j]; } } ll sum = 0; rep(i, 0, 8) { sum = (sum + dp[i]) % mod; } ll ans = (powmod(2, n) + mod - sum) % mod; cout << ans << endl; return 0; }