#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <chrono>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define itn int
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define matrix vector<vector<ll>>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end())
#define mn(v) min_element(v.begin(), v.end())
#define dig(c) (c >=' 0' && c <= '9') ? 1 : 0
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); i++) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); i++) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); i++) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; i++){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000000000 + 228;
const ld PI = acos(-1.0);
const int mod7 = 1000000000 + 7;
const int mod9 = 1000000000 + 9;
const int MAXN = 200005;
const ld EPS = 1e-10;
const int N = 300228;
ll hp = 29;
vector<string> kek{ "AGC","GAC","ACG","ATGC","AAGC","AGGC","ACGC","AGAC","AGTC","AGGC", "AGCT", "AGCA","AGCC","AGCG","GAGC","TAGC","AAGC","CAGC" };
bool good(string s)
{
	return find(all(kek), s) == kek.end();
}
bool rg(string s)
{
	return good(s) && good(string(s.begin(), s.begin() + 3)) && good(string(s.begin() + 1, s.end()));
}
vector<char> lol{ 'A','G','C','T' };
map<string, int> dp[101];
signed main()
{
	fastio();
	int n;
	cin >> n;
	if (n == 2)
	{
		cout << 16;
	}
	else if (n == 3)
	{
		cout << 61;
		return 0;
	}
	else if (n == 4)
	{
		cout << 230;
		return 0;
	}
	vector<string> ok;
	for (char a : lol)
	{
		for (char b : lol)
		{
			for (char c : lol)
			{
				for (char d : lol)
				{
					string s = "";
					s.pbc(a);
					s.pbc(b);
					s.pbc(c);
					s.pbc(d);
					if (rg(s))
					{
						ok.pbc(s);
						dp[4][s] = 1;
					}
				}
			}
		}
	}
	/*for (auto i : ok)
	{
		cout << i << endl;
	}
	cout << ok.size();
	sp;*/
	for (int i = 5; i <= n; ++i)
	{
		for (string en : ok)
		{
			for (string kek : ok)
			{
				if (string(kek.begin() + 1, kek.end()) == string(en.begin(), en.begin() + 3))
				{
					dp[i][en] += dp[i - 1][kek];
					if(dp[i][en] >=mod7)dp[i][en] -= mod7;
				}
			}
		}
	}
	ll ans = 0;
	for (string i : ok)
	{
		ans += dp[n][i];
	}
	cout << (ans % mod7);
	sp;
}

Measured memory_bytes: 2936