object Main{
	def main(args:Array[String]){
		val n = new java.util.Scanner(System.in).nextInt
		val a = Array.fill(n + 1,4,4,4)(0L)
		val A = 0
		val C = 1
		val G = 2
		val T = 3
		a(0)(T)(T)(T) = 1
		val mod = 1000000007

		def f(a:Int,b:Int,c:Int,A:Int,B:Int,C:Int)
		= a == A && b == B && c == C

		for {
			i <- 1 to n
			j <- 0 to 3
			k <- 0 to 3
			l <- 0 to 3
			m <- 0 to 3
			if !(   f(k,l,m,A,G,C) ||
					f(k,l,m,G,A,C) ||
					f(k,l,m,A,C,G) ||

					f(j,k,m,A,G,C) ||
					f(j,l,m,A,G,C))
		} {
			a(i)(k)(l)(m) += a(i - 1)(j)(k)(l)
			a(i)(k)(l)(m) %= mod
		}
		println(a(n).flatten.flatten.sum % mod)
	}
}
