#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;

public:
u64 a;

constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
constexpr u64 &value() noexcept { return a; }
constexpr const u64 &value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint &operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint &operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint &operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint &operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};

using mint = modint<MOD>;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<vector<vector<vector<mint>>>> dp(N+1, vector<vector<vector<mint>>>(4, vector<vector<mint>> (4, vector<mint>(4))));
    rep(i,4) {
        rep(j,4) {
            rep(k,4) {
                if (i == 0 && j == 2 && k == 1) continue;
                if (i == 0 && j == 1 && k == 2) continue;
                if (i == 2 && j == 0 && k == 1) continue;
                dp[3][i][j][k] = 1;
            }
        }
    }
    for (int n = 3; n < N; n++) {
        rep(i,4) {
            rep(j,4) {
                rep(k,4) {
                    rep(l,4) {
                        if (i == 0 && j == 2 && k == 1) continue;
                        if (i == 0 && j == 2 && l == 1) continue;
                        if (i == 0 && k == 2 && l == 1) continue;
                        if (j == 0 && k == 2 && l == 1) continue;
                        if (i == 0 && j == 1 && k == 2) continue;
                        if (j == 0 && k == 1 && l == 2) continue;
                        if (i == 2 && j == 0 && k == 1) continue;
                        if (j == 2 && k == 0 && l == 1) continue;
                        dp[n+1][j][k][l] += dp[n][i][j][k];
                    }
                }
            }
        }
    }

    mint ans = 0;
    rep(i,4) {
        rep(j,4) {
            rep(k,4) ans += dp[N][i][j][k];
        }
    }

    cout << ans.a << endl;
}

Measured memory_bytes: 384