fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    var a = mutableMapOf<String,Int>()
    var b = mutableMapOf<String,Int>()

    a["TTTT"]=1

    repeat(N){ i ->
        a.forEach{
            "ACGT".forEach { c ->
                val s = it.key.drop(1) + c
                if(ok4(s)) b[s] = ( (b[s]?:0) + it.value) % 1000000007
            }
        }
        a = b
        b = mutableMapOf()
    }

    val ans = a.map { it.value }.reduce { a,b -> (a+b)%1000000007 }
    println(ans)
}

fun ok4(s:String):Boolean = listOf(
        s.matches(Regex("[ATGC]AGC")),
        s.matches(Regex("A[ATGC]GC")),
        s.matches(Regex("AG[ATGC]C")),
        s.matches(Regex("[ATGC]ACG")),
        s.matches(Regex("[ATGC]GAC")) ).none{ it }