#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

template<class T>
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	auto dp = make_vec(N + 1, 4, 4, 4,mint(0));
	

	//AGCTが0123に対応
	for (Int i = 0; i < 4; i++) {
		for (Int j = 0; j < 4; j++) {
			for (Int k = 0; k < 4; k++) {
				if (i == 0 && j == 1 && k == 2)continue;
				if (i == 0 && j == 2 && k == 1)continue;
				if (i == 1 && j == 0 && k == 2)continue;
				dp[3][i][j][k] = 1;
			}
		}
	}

	for (Int n = 3; n < N; n++) {
		for (Int i = 0; i < 4; i++) {
			for (Int j = 0; j < 4; j++) {
				for (Int k = 0; k < 4; k++) {
					for (Int l = 0; l < 4; l++) {
						if (i == 0 && j == 1 && l == 2)continue;
						if (i == 0 && k == 1 && l == 2)continue;
						if (j == 0 && k == 1 && l == 2)continue;
						if (j == 1 && k == 0 && l == 2)continue;
						if (j == 0 && k == 2 && l == 1)continue;
						dp[n + 1][j][k][l] += dp[n][i][j][k];
					}
				}
			}
		}
	}

	mint ans = 0;
	for (Int i = 0; i < 4; i++) {
		for (Int j = 0; j < 4; j++) {
			for (Int k = 0; k < 4; k++) {
				ans += dp[N][i][j][k];
			}
		}
	}

	cout << ans << "\n";
}

Measured memory_bytes: 384