#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

template <std::int_fast64_t Modulus>
class modint
{
	using u64 = std::int_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;
	}
};
typedef modint<MOD> ModInt;

lint N;
ModInt dp[101][1<<8]; //00 A, 01 C, 10 G, 11 T

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	dp[0][0] = 1;
	REP(i, N) {
		REP(j, 1 << 8) {
			if (3 < i) {
				if (j / 4 == 0b001001) dp[i][j] = 0;//AGC?
				if (j % (1 << 6) == 0b001001) dp[i][j] = 0;//?AGC
				if (j / 4 == 0b100001) dp[i][j] = 0;//GAC?
				if (j % (1 << 6) == 0b100001) dp[i][j] = 0;//?GAC
				if (j / 4 == 0b000110) dp[i][j] = 0;//ACG?
				if (j % (1 << 6) == 0b000110) dp[i][j] = 0;//?ACG
				if (j / (1 << 6) == 0b00 && j % (1 << 4) == 0b1001) dp[i][j] = 0;//A?GC
				if (j / (1 << 4) == 0b0010 && j % (1 << 2) == 0b01) dp[i][j] = 0;//AG?C
			}
			else if(i == 3) {
				if (j % (1 << 6) == 0b001001) dp[i][j] = 0;//?AGC
				if (j % (1 << 6) == 0b000110) dp[i][j] = 0;//?ACG
				if (j % (1 << 6) == 0b100001) dp[i][j] = 0;//?GAC
			}
			dp[i + 1][((j << 2) + 0b00) & 0b11111111] += dp[i][j];
			dp[i + 1][((j << 2) + 0b01) & 0b11111111] += dp[i][j];
			dp[i + 1][((j << 2) + 0b10) & 0b11111111] += dp[i][j];
			dp[i + 1][((j << 2) + 0b11) & 0b11111111] += dp[i][j];
		}
	}
	ModInt ans = 0;
	REP(j, 1 << 8) {
		if (N != 3) {
			if (j / 4 == 0b001001) dp[N][j] = 0;//AGC?
			if (j % (1 << 6) == 0b001001) dp[N][j] = 0;//?AGC
			if (j / 4 == 0b100001) dp[N][j] = 0;//GAC?
			if (j % (1 << 6) == 0b100001) dp[N][j] = 0;//?GAC
			if (j / 4 == 0b000110) dp[N][j] = 0;//ACG?
			if (j % (1 << 6) == 0b000110) dp[N][j] = 0;//?ACG
			if (j / (1 << 6) == 0b00 && j % (1 << 4) == 0b1001) dp[N][j] = 0;//A?GC
			if (j / (1 << 4) == 0b0010 && j % (1 << 2) == 0b01) dp[N][j] = 0;//AG?C
		}
		else {
			if (j == 0b001001) dp[N][j] = 0;//?AGC
			if (j == 0b000110) dp[N][j] = 0;//?ACG
			if (j == 0b100001) dp[N][j] = 0;//?GAC
		}
		ans += dp[N][j];
	}
	cout << ans.a << endl;
}


Measured memory_bytes: 3776