fun main(args: Array<String>) {
    val mod = 1000000007L
    val n = readLine()!!.toInt()

    val dp = Array(n + 1) { Array(4) { Array(4) { LongArray(4) { 0 } } } }
    dp[0][3][3][3] = 1

    for (i in (0 until n)) {
        for (c1 in (0 until 4)) {
            for (c2 in (0 until 4)) {
                for (c3 in (0 until 4)) {
                    for (c4 in (0 until 4)) {
                        // .AGC
                        if (c2 == 0 && c3 == 1 && c4 == 2) {
                            continue
                        }

                        // .GAC
                        if (c2 == 1 && c3 == 0 && c4 == 2) {
                            continue
                        }

                        // .ACG
                        if (c2 == 0 && c3 == 2 && c4 == 1) {
                            continue
                        }

                        // A.GC
                        if (c1 == 0 && c3 == 1 && c4 == 2) {
                            continue
                        }

                        // AG.C
                        if (c1 == 0 && c2 == 1 && c4 == 2) {
                            continue
                        }

                        dp[i + 1][c2][c3][c4] += dp[i][c1][c2][c3] % mod
                    }
                }
            }
        }
    }

    var ans = 0L

    for (i in (0 until 4))
        for (j in (0 until 4))
            for (k in (0 until 4)) {
                ans += dp[n][i][j][k] % mod
            }

    println(ans % mod)
}
