'use strict'

/////////////////////////////////////
//コピペスペース//////////////////////

//定数
const INF  =  900719925474099 // Math.floor(Number.MAX_SAFE_INTEGER / 10);

//スペース区切りの数字列を数字の配列にして返す
function mapint(line){return line.split(' ').map((v)=>parseInt(v));}

function lower_bound(d,a,b,e){
    for(var c;1<b-a;)
        d[c=0|(a+b)/2]<e ? a=c : b=c;
    return d[a]<e?b:a
};

const MOD = 1000000007;
//コピペスペース//////////////////////
/////////////////////////////////////

const A = 0;
const C = 1;
const G = 2;
const T = 3;

function getACGTs(n){
	let s=[];
	let t = new Array(3);
	t[0] = n >> 4;
	t[1] = (n >> 2) & 3;
	t[2] = n&3;

	for(let i=0;i<3;i++){
		if(t[i] == A) s.push('A');
		if(t[i] == C) s.push('C');
		if(t[i] == G) s.push('G');
		if(t[i] == T) s.push('T');
	}
	return s.join('');

}
function getACGT(n){
		if(n == A) return 'A';
		if(n == C) return 'C';
		if(n == G) return 'G';
		if(n == T) return 'T';
}

function Main(input){
	let temp = input.trim();
	let n = parseInt(temp);

	let s = [...new Array(n+10)].map(()=>new Array(64).fill(0));

	for(let i=0;i<64;i++){
		s[3][i] = 1;
	}
	s[3][9] = 0; //AGC
	s[3][33] = 0; //GAC
	s[3][6] = 0; //ACG

	let add;
	let t;
	for(let i=4;i<=n;i++){
		//console.log('i---------------',i);
		for(let j=0;j<64;j++){
			//console.log('j=======',getACGTs(j));
			for(let k=0;k<4;k++){
				add = s[i-1][j];
				if(k==C){
					if( (j&60) == ((A<<4)+(G<<2)) ) add = 0;   //AGx => C
					else if( (j&15) == ((A<<2)+G) ) add = 0; //xAG -> C
					else if( (j&51) == ((A<<4)+G) ) add = 0; //AxG -> C
					else if( (j&15) == ((G<<2)+A) ) add = 0; //xGA -> C
				}else if(k==G){
					if( (j&15)==((A<<2)+C) ) add = 0; //xAC -> G
				}
				t = ((j&15) << 2) + k;
				s[i][t] += add;
				s[i][t] %= MOD;
				//console.log(getACGT(k),' t:',t,'add:',add);
			}
		}
	}
	let sum = 0;
	for(let i=0;i<64;i++){
		sum += s[n][i];
		sum %= MOD;
	}

	//console.log(s);
	console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
