import scala.io.{StdIn => in}

object Main extends App {
  val mod = 1000000007
  val n = in.readInt

  val Array(a, c, g, t) = Array(0, 1, 2, 3)
  val dp = Array.ofDim[Long](n+1, 4, 4, 4)
  dp(0)(t)(t)(t) = 1

  for {
    // len(全体) : i + j + k + x
    // len(全体) : _ + A + G + C  <- ガード式1行目
    len <- 0 until n
    i <- 0 until 4
    j <- 0 until 4
    k <- 0 until 4
    if dp(len)(i)(j)(k) != 0
    x <- 0 until 4
    if !((j == a && k == g && x == c) ||
         (j == g && k == a && x == c) ||
         (j == a && k == c && x == g) ||
         (i == a && k == g && x == c) ||
         (i == a && j == g && x == c) )
  } {
    dp(len+1)(j)(k)(x) += dp(len)(i)(j)(k)
    dp(len+1)(j)(k)(x) %= mod
  }

  val ans = dp(n).flatten.flatten.sum % mod
  println(ans)
}