#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<vector<long long int>>dp(N + 1, vector<long long int>(1 << 16));
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 1 << 16; j++) {
			dp[i][j] %= MOD;
			for (int k = 0; k < 4; k++) {
				int box = (j << 4 | (1 << k))&((1 << 16) - 1);
				if (box == ((1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 12) | (1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 0)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 1)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 3)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 14) | (1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 15) | (1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 1)))continue;
			//	if (box == ((1 << 12) | (1 << 10) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 9) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 13) | (1 << 9) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 14) | (1 << 9) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 15) | (1 << 9) | (1 << 4) | (1 << 2)))continue;
				//if (box == ((1 << 13) | (1 << 8) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 6) | (1 << 2)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 6) | (1 << 0)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 6) | (1 << 3)))continue;
				if (box == ((1 << 12) | (1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 13) | (1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 14) | (1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 15) | (1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 8) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 10) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 11) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 4) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 5) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 6) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 7) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 6) | (1 << 0)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 6) | (1 << 1)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 6) | (1 << 2)))continue;
				if (box == ((1 << 12) | (1 << 9) | (1 << 6) | (1 << 3)))continue;
				//cout << i << " " << j << " " << k << endl;
				dp[i + 1][box] += dp[i][j];
			}
		}
	}
	cout << accumulate(dp.back().begin(), dp.back().end(), 0LL) % MOD << endl;
	return 0;
}

Measured memory_bytes: 52864