#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

// AA -> ACGT
// AC -> AC_T
// AG -> A_GT
// AT -> ACGT

// CA -> ACGT
// CC -> ACGT
// CG -> ACGT
// CT -> ACGT

// GA -> A_GT
// GC -> ACGT
// GG -> ACGT
// GT -> ACGT

// TA -> ACGT
// TC -> ACGT
// TG -> ACGT
// TT -> ACGT

string endswith[16] = {
	"AA", "AC", "AG", "AT",
	"CA", "CC", "CG", "CT",
	"GA", "GC", "GG", "GT",
	"TA", "TC", "TG", "TT",
};

int main() {
	sll(n);
	map<string, LL> count[n+1];
	rep(i, 1, n+1) {
		if(i == 1) {
			count[i]["A"] = 1;
			count[i]["C"] = 1;
			count[i]["G"] = 1;
			count[i]["T"] = 1;
		}
		else if(i == 2) {
			count[i]["AA"] = count[i-1]["A"];
			count[i]["AC"] = count[i-1]["A"];
			count[i]["AG"] = count[i-1]["A"];
			count[i]["AT"] = count[i-1]["A"];

			count[i]["CA"] = count[i-1]["C"];
			count[i]["CC"] = count[i-1]["C"];
			count[i]["CT"] = count[i-1]["C"];
			count[i]["CG"] = count[i-1]["C"];

			count[i]["GA"] = count[i-1]["G"];
			count[i]["GC"] = count[i-1]["G"];
			count[i]["GG"] = count[i-1]["G"];
			count[i]["GT"] = count[i-1]["G"];

			count[i]["TA"] = count[i-1]["T"];
			count[i]["TC"] = count[i-1]["T"];
			count[i]["TG"] = count[i-1]["T"];
			count[i]["TT"] = count[i-1]["T"];
		}
		else {
			count[i]["AA"] = (count[i-1]["AA"] + count[i-1]["CA"] + count[i-1]["GA"] + count[i-1]["TA"]) % MOD;
			count[i]["AC"] = (count[i-1]["AA"] + count[i-1]["CA"] +			0		+ count[i-1]["TA"]) % MOD;
			count[i]["AG"] = (count[i-1]["AA"] + count[i-1]["CA"] + count[i-1]["GA"] + count[i-1]["TA"]) % MOD;
			count[i]["AT"] = (count[i-1]["AA"] + count[i-1]["CA"] + count[i-1]["GA"] + count[i-1]["TA"]) % MOD;

			count[i]["CA"] = (count[i-1]["AC"] + count[i-1]["CC"] + count[i-1]["GC"] + count[i-1]["TC"]) % MOD;
			count[i]["CC"] = (count[i-1]["AC"] + count[i-1]["CC"] + count[i-1]["GC"] + count[i-1]["TC"]) % MOD;
			count[i]["CG"] = (		0		  + count[i-1]["CC"] + count[i-1]["GC"] + count[i-1]["TC"]) % MOD;
			count[i]["CT"] = (count[i-1]["AC"] + count[i-1]["CC"] + count[i-1]["GC"] + count[i-1]["TC"]) % MOD;

			count[i]["GA"] = (count[i-1]["AG"] + count[i-1]["CG"] + count[i-1]["GG"] + count[i-1]["TG"]) % MOD;
			count[i]["GC"] = (		0		  + count[i-1]["CG"] + count[i-1]["GG"] + count[i-1]["TG"] - count[i-2]["AT"] - count[i-2]["AG"] + MOD) % MOD;
			count[i]["GG"] = (count[i-1]["AG"] + count[i-1]["CG"] + count[i-1]["GG"] + count[i-1]["TG"]) % MOD;
			count[i]["GT"] = (count[i-1]["AG"] + count[i-1]["CG"] + count[i-1]["GG"] + count[i-1]["TG"]) % MOD;

			count[i]["TA"] = (count[i-1]["AT"] + count[i-1]["CT"] + count[i-1]["GT"] + count[i-1]["TT"]) % MOD;
			count[i]["TC"] = (count[i-1]["AT"] + count[i-1]["CT"] + count[i-1]["GT"] + count[i-1]["TT"] - count[i-2]["AG"] + MOD) % MOD;
			count[i]["TG"] = (count[i-1]["AT"] + count[i-1]["CT"] + count[i-1]["GT"] + count[i-1]["TT"]) % MOD;
			count[i]["TT"] = (count[i-1]["AT"] + count[i-1]["CT"] + count[i-1]["GT"] + count[i-1]["TT"]) % MOD;
		}
	}
	LL ans = 0;
	ans += (count[n]["AA"] + count[n]["CA"] + count[n]["GA"] + count[n]["TA"]) % MOD;
	ans %= MOD;
	ans += (count[n]["AC"] + count[n]["CC"] + count[n]["GC"] + count[n]["TC"]) % MOD;
	ans %= MOD;
	ans += (count[n]["AG"] + count[n]["CG"] + count[n]["GG"] + count[n]["TG"]) % MOD;
	ans %= MOD;
	ans += (count[n]["AT"] + count[n]["CT"] + count[n]["GT"] + count[n]["TT"]) % MOD;
	ans %= MOD;
	pll(ans); nl;
}


Measured memory_bytes: 384