#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////
int num(char S) {
	
	if (S == 'A') {
		return 1;
	}
	else if (S == 'C') {
		return 2;
	}
	else if (S == 'G') {
		return 3;
	}
	else if (S == 'T') {
		return 4;
	}
	return INF;
}
int index(string S) {
	int mul = 5;
	int len = S.size();
	int ans = 0;
	for (int i =0;i<len;++i){
		int ter = num(S[i]);
		ans = ans * mul + ter;
	}
	return ans;
}
void solve() {
	int N;
	cin >> N;

	map<int, int> NG;
	vector<pair<string, string>> NGList;
	NGList.push_back(pair<string, string>("AG", "C"));
	NGList.push_back(pair<string, string>("GA", "C"));
	NGList.push_back(pair<string, string>("AC", "G"));

	NGList.push_back(pair<string, string>("AAG","C"));
	NGList.push_back(pair<string, string>("CAG", "C"));
	NGList.push_back(pair<string, string>("GAG", "C"));
	NGList.push_back(pair<string, string>("TAG", "C"));

	NGList.push_back(pair<string, string>("AGA", "C"));
	NGList.push_back(pair<string, string>("CGA", "C"));
	NGList.push_back(pair<string, string>("GGA", "C"));
	NGList.push_back(pair<string, string>("TGA", "C"));

	NGList.push_back(pair<string, string>("AAC", "G"));
	NGList.push_back(pair<string, string>("CAC", "G"));
	NGList.push_back(pair<string, string>("GAC", "G"));//こない
	NGList.push_back(pair<string, string>("TAC", "G"));

	NGList.push_back(pair<string, string>("AAG", "C"));
	NGList.push_back(pair<string, string>("ACG", "C"));//こないね
	NGList.push_back(pair<string, string>("AGG", "C"));
	NGList.push_back(pair<string, string>("ATG", "C"));

	NGList.push_back(pair<string, string>("AGA", "C"));
	NGList.push_back(pair<string, string>("AGG", "C"));
	NGList.push_back(pair<string, string>("AGC", "C"));
	NGList.push_back(pair<string, string>("AGT", "C"));

	vector<pair<string, string>>::iterator itr;
	for (itr = NGList.begin(); itr != NGList.end(); itr++) {
		pair<string, string> temp = *itr;
		NG[index(temp.first)] = index(temp.second);
	}
	vector<vector<LL>>dp(N + 1, vector<LL>(130,0));
	dp[0][0] = 1;
	string LOOP = "ACGT";
	int mul = 5;
	int mod = 125;
	for (int i = 0; i < N; ++i) {
		for (int k = 0; k <= index("TTT"); ++k) {
			if (dp[i][k] == 0)continue;
			for (int j = 0; j < 4; ++j) {
				int ter = num(LOOP[j]);
				if (NG[k] == ter) {
					continue;
				}
				int next = (k*mul + ter) % mod;
				dp[i+1][next] += dp[i][k];
				dp[i + 1][next] %= MOD;
			}
		}
	}
	LL ans = 0;
	for (int k = 0; k < mod; ++k) {
		ans += dp[N][k];
		ans %= MOD;
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 384