fun main(args: Array<String>) {
    val (A,G,C,T) = Array(4){it}
    val n=readLine()!!.toInt()
    var arr = Array(4){Array(4){Array(4){1}}}
    arr[A][G][C]=0
    arr[A][C][G]=0
    arr[G][A][C]=0
    for(i in 0 until n-3){
        val arr2 = Array(4){Array(4){Array(4){0}}}
        for(j in 0 until 4)
            for(k in 0 until 4)
                for(m in 0 until 4){
                    arr2[k][m][A]+=arr[j][k][m]
                    arr2[k][m][T]+=arr[j][k][m]
                    if(k!=A||m!=C)arr2[k][m][G]+=arr[j][k][m]
                    if(!(k==A&&m==G)&&!(j==A&&k==G)&&!(k==G&&m==A)&&!(j==A&&m==G))arr2[k][m][C]+=arr[j][k][m]
                    for(o in 0 until 4){arr2[k][m][o]%=1000000007}
        }
        arr = arr2
    }
    var result =0
    for(j in 0 until 4)
        for(k in 0 until 4)
            for(m in 0 until 4){
                result+=(arr[j][k][m])
                result%=1000000007
            }
    print(result)
}