object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val Mod = 1000000007L
  val (a, c, g, t) = (0, 1, 2, 3)
  val dp = Array.ofDim[Long](n + 1, 4, 4, 4)
  dp(0)(t)(t)(t) = 1

  def valid(p3: Int, p2: Int, p1: Int, cur: Int): Boolean = !(
               p2 == a && p1 == g && cur == c ||
               p2 == g && p1 == a && cur == c ||
               p2 == a && p1 == c && cur == g ||
    p3 == a &&            p1 == g && cur == c ||
    p3 == a && p2 == g &&            cur == c)

  for {
    i <- (1 to n)
    p3 <- (0 to 3)
    p2 <- (0 to 3)
    p1 <- (0 to 3)
    cur <- (0 to 3)
    if (valid(p3, p2, p1, cur))
  } {
    dp(i)(p2)(p1)(cur) = (dp(i)(p2)(p1)(cur) + dp(i - 1)(p3)(p2)(p1)) % Mod
  }
  println(dp(n).map(_.map(_.sum % Mod).sum % Mod).sum % Mod)
}