#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; } VV dp(n + 1, V(8)); ll ans = 0; rep(i, 0, 8) { dp[3][i] = 1; } rep(i, 3, n) { dp[i + 1][0] = (dp[i][0] + dp[i][4]) % mod; dp[i + 1][1] = (dp[i][0] + dp[i][4]) % mod; dp[i + 1][2] = dp[i][1] % mod; dp[i + 1][3] = (dp[i][1] + dp[i][5]) % mod; dp[i + 1][4] = (dp[i][2] + dp[i][6]) % mod; dp[i + 1][5] = (dp[i][2] + dp[i][6]) % mod; dp[i + 1][6] = (dp[i][3] + dp[i][7]) % mod; dp[i + 1][7] = (dp[i][3] + dp[i][7]) % mod; } ll sum = 0; rep(i, 0, 8) { sum = (sum + dp[n][i]) % mod; } ans = (powmod(2, n) + mod - sum) % mod; cout << ans << endl; return 0; }