/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 100 + 10;

namespace ModFunctions {
	const int F = 2e5 + 10;

	int fact[F], inv_fact[F];

	inline void add(int &a, int b) {
		a += b;
		if (a >= MOD) {
			a -= MOD;
		}
	}

	inline void sub(int &a, int b) {
		a -= b;
		if (a < 0) {
			a += MOD;
		}
	}

	inline int mul(int a, int b) {
		return int((1ll * a * b) % MOD);
	}

	inline int power(int a, ll b) {
		int res = 1;
		while (b > 0) {
			if (b & 1) {
				res = mul(res, a);
			}
			a = mul(a, a);
			b >>= 1;
		}
		return res;
	}

	inline int inv(int a) {
		a %= MOD;
		if (a < 0) {
			a += MOD;
		}
		int b = MOD, u = 0, v = 1;
		while (a) {
			int t = b / a;
			b -= t * a;
			swap(a, b);
			u -= t * v;
			swap(u, v);
		}
		assert(b == 1);
		if (u < 0) {
			u += MOD;	
		}
		return u;
	}

	void pre_build() {
		fact[0] = 1;
		for (int i = 1; i < F; ++i) {
			fact[i] = mul(fact[i - 1], i);
		}
		inv_fact[F - 1] = inv(fact[F - 1]);
		for (int i = F - 2; i >= 0; --i) {
			inv_fact[i] = mul(inv_fact[i + 1], i + 1);
		}
	}

	int choose(int x, int y) {
		if (x < y) {
			return 0;
		}
		return mul(fact[x], mul(inv_fact[y], inv_fact[x - y]));
	}
}

using namespace ModFunctions;

int n;
string allowed = "ACGT";
int dp[N][4][4][4][4];

void test_case();
int solve(int ind, string prv);
bool ok(string s);
bool check(string s);

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	cin >> n;
	memset(dp, -1, sizeof(dp));
	cout << solve(1, "qwep") << "\n";
}

int solve(int ind, string prv) {
	if (ind == n + 1) {
		return 1;
	}
	auto &ans = dp[ind][allowed.find(prv[0])][allowed.find(prv[1])][allowed.find(prv[2])][allowed.find(prv[3])];
	if (ans == -1) {
		ans = 0;
		if (ok(prv)) {
			for (auto &ch: allowed) {
				string nxt = prv.substr(1) + ch;
				if (check(nxt)) {
					add(ans, solve(ind + 1, nxt));
				}
			}
		}
	}
	return ans;
}

bool ok(string s) {
	return s.find("AGC") == string::npos;
}

bool check(string s) {
	bool bad = !ok(s);
	for (int i = 0; i < s.size() - 1; ++i) {
		swap(s[i], s[i + 1]);
		bad = bad | (!ok(s));
		swap(s[i], s[i + 1]);
	}
	return !bad;
}

Measured memory_bytes: 384