object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt
    // T=0,A=1,G=2,C=3
    val dp = Array.ofDim[Int](N + 1, 4, 4, 4)
    dp(0)(0)(0)(0) = 1
    for (i <- 0 until N; c3 <- 0 until 4; c2 <- 0 until 4; c1 <- 0 until 4; c <- 0 until 4) {
      (c3, c2, c1, c) match {
        case (_, 1, 2, 3) |
             (_, 2, 1, 3) |
             (_, 1, 3, 2) |
             (1, _, 2, 3) |
             (1, 2, _, 3) =>
        case _ =>
          dp(i + 1)(c2)(c1)(c) = (dp(i + 1)(c2)(c1)(c) + dp(i)(c3)(c2)(c1)) % 1000000007
      }
    }
    var result = 0L
    for (c2 <- 0 until 4; c1 <- 0 until 4; c <- 0 until 4) {
      result = (result + dp(N)(c2)(c1)(c)) % 1000000007
    }
    println(result)
  }
}