fun main(args: Array<String>) {
    val N = nextInt()
    val dp = Array(N + 1) { Array(4) { Array(4) { Array(4) { 0 } } } }
    var MOD = 1000000007
    // A C G T -> 0 1 2 3
    dp[0][3][3][3] = 1
    for (len in 0 until N)
        for (c1 in 0 until 4)
            for (c2 in 0 until 4)
                for (c3 in 0 until 4) {
                    if (dp[len][c1][c2][c3] == 0) continue
                    for (a in 0 until 4) {
                        if (a == 2 && c1 == 1 && c2 == 0) continue // 0 1 2
                        if (a == 2 && c1 == 0 && c2 == 1) continue // 1 0 2
                        if (a == 1 && c1 == 2 && c2 == 0) continue // 0 2 1
                        if (a == 2 && c1 == 1 && c3 == 0) continue // 0 ? 1 2
                        if (a == 2 && c2 == 1 && c3 == 0) continue // 0 1 ? 2
                        // S = ...... c3 c2 c1
                        // nextS = ...... c2 c1 a
                        dp[len + 1][a][c1][c2] += dp[len][c1][c2][c3]
                        dp[len + 1][a][c1][c2] %= MOD
                    }
                }
    var ans = 0
    for (c1 in 0 until 4)
        for (c2 in 0 until 4)
            for (c3 in 0 until 4) {
                ans += dp[N][c1][c2][c3]
                ans %= MOD
            }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())