import java.util.*

object MainKt {
	@JvmStatic
	fun main(args: Array<String>) {
		val mod: Long = Math.pow(10.0,9.0).toLong() +7L

		val scanner = Scanner(System.`in`)
		val n = scanner.nextInt()

		if (n==3) {
			println(61)
			System.exit(0)
		}
		var map = mutableMapOf<String, Long>()
		for(i in 0..63) if(i!=11 && i!=14 && i!=50) map.put(to3s(i), 1L)

		for(l in 4..n) {
			val newMap = mutableMapOf<String, Long>()
			map.forEach {
				for (i in 0..3) {
					val next4 = it.key + toChar(i)
					if (!next4.endsWith("AGC") && !next4.endsWith("ACG") && !next4.endsWith("GAC")) {
						if (!next4.startsWith('A') || !next4.endsWith('C') || !next4.contains('G')) {
							val next3 = next4.substring(1)
							val bef: Long = newMap.get(next3) ?: 0L
							newMap.put(next3, (bef+it.value)%mod)
						}
					}
				}
			}
			map = newMap
		}

		var ans = 0L
		map.forEach { ans = (ans+it.value)%mod }

		println(ans)

	}

	@JvmStatic
	fun toChar(num: Int): Char{
		return when(num){
			0->'A'
			1->'T'
			2->'C'
			3->'G'
			else->'?'
		}
	}

	@JvmStatic
	fun to3s(num: Int): String{
		return toChar(num/16).toString() + toChar((num/4)%4) + toChar(num%4)
	}
}