// Slower C++ solution:
#include <iostream>

#include <string>

#include <cstring>

#include <algorithm>

#include <functional>

#include <cmath>

#include <set>

#include <queue>

#include <deque>

#include <vector>

#include <climits>

#include <sstream>

#include <iomanip>

#include <map>

#include <stack>

using namespace std;

typedef unsigned long long ull;

typedef long long ll;



int main()

{

	int N;

	cin >> N;



	ll dp[100][4][4][4][4];

	memset(dp, 0, sizeof(dp));



	set<string> s;

	s.insert("AGC");

	s.insert("ACG");

	s.insert("GAC");

	s.insert("AGGC");

	s.insert("AGTC");

	s.insert("ATGC");



	char chars[] = { 'A', 'G', 'C', 'T' };

	auto mod = (ll)1e9 + 7;



	for (auto i = 0; i < N; ++i)

	{

		for (auto j = 0; j < 4; ++j)

		{

			if (i == 0)

			{

				dp[i][j][0][0][0] = 1;

				continue;

			}



			for (auto k = 0; k < 4; ++k)

			{

				if (i == 1)

				{

					dp[i][j][k][0][0] = 1;

					continue;

				}



				for (auto l = 0; l < 4; ++l)

				{

					string temp;

					temp += chars[l];

					temp += chars[k];

					temp += chars[j];

					if (s.find(temp) != s.end())

					{

						continue;

					}



					if (i == 2)

					{

						dp[i][j][k][l][0] = 1;

						continue;

					}



					for (auto m = 0; m < 4; ++m)

					{

						string temp;

						temp += chars[m];

						temp += chars[l];

						temp += chars[k];

						temp += chars[j];

						if (s.find(temp) != s.end())

						{

							continue;

						}



						for (auto n = 0; n < 4; ++n)

						{

							dp[i][j][k][l][m] =

								(dp[i][j][k][l][m] + dp[i - 1][k][l][m][n]) % mod;

						}

					}

				}

			}

		}

	}



	auto ans = 0ll;

	for (auto j = 0; j < 4; ++j)

	{

		for (auto k = 0; k < 4; ++k)

		{

			for (auto l = 0; l < 4; ++l)

			{

				for (auto m = 0; m < 4; ++m)

				{

					ans = (ans + dp[N - 1][j][k][l][m]) % mod;

				}

			}

		}

	}

	cout << ans << endl;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.6933397323581854x):
#include <iostream>

#include <string>

#include <cstring>

#include <algorithm>

#include <functional>

#include <cmath>

#include <set>

#include <queue>

#include <deque>

#include <vector>

#include <climits>

#include <sstream>

#include <iomanip>

#include <map>

#include <stack>

using namespace std;

typedef unsigned long long ull;

typedef long long ll;



int main()

{

	int N;

	cin >> N;



	vector<vector<vector<vector<ll>>>> dp(N + 1, vector<vector<vector<ll>>>(4, vector<vector<ll>>(4, vector<ll>(4))));

	dp[0][3][3][3] = 1;

	auto mod = (ll)1e9 + 7;



	for (auto i = 0; i < N; ++i)

	{

		for (auto j = 0; j < 4; ++j)

		{

			for (auto k = 0; k < 4; ++k)

			{

				for (auto l = 0; l < 4; ++l)

				{

					for (auto m = 0; m < 4; ++m)

					{

						if (m == 2)

						{

							if (l == 1 && k == 0)

							{

								continue;

							}

							if (l == 0 && k == 1)

							{

								continue;

							}

							if (k == 1 && j == 0)

							{

								continue;

							}

							if (l == 1 && j == 0)

							{

								continue;

							}

						}

						else if (m == 1 && l == 2 && k == 0)

						{

							continue;

						}

						dp[i + 1][m][l][k] += dp[i][l][k][j];

						dp[i + 1][m][l][k] %= mod;

					}

				}

			}

		}

	}



	auto ans = 0ll;

	for (auto j = 0; j < 4; ++j)

	{

		for (auto k = 0; k < 4; ++k)

		{

			for (auto l = 0; l < 4; ++l)

			{

				ans = (ans + dp[N][j][k][l]) % mod;

			}

		}

	}

	cout << ans << endl;



	return 0;

}