import           Control.Monad
import           Data.Array.IO

md = 1000000007

type Index = (Int, Int, Int, Int)

solve :: (IOUArray Index Int) -> Index -> IO ()
solve dp idx @ (l, c1, c2, c3) = forM_ [0 .. 3]
  $ \a -> do
    case (a, c1, c2, c3) of
      (2, 1, 0, _) -> return ()
      (2, 0, 1, _) -> return ()
      (1, 2, 0, _) -> return ()
      (2, 1, _, 0) -> return ()
      (2, _, 1, 0) -> return ()
      _ -> do
        let idx' = (l + 1, a, c1, c2)
        a <- readArray dp idx'
        b <- readArray dp idx
        writeArray dp idx' ((a + b) `mod` md)
        return ()

main :: IO ()
main = do
  n <- readLn :: IO Int
  dp <- newArray ((0, 0, 0, 0), (n, 3, 3, 3)) 0 :: IO (IOUArray Index Int)
  writeArray dp (0, 3, 3, 3) 1
  forM_
    [(l, c1, c2, c3)
    | l <- [0 .. n - 1]
    , c1 <- [0 .. 3]
    , c2 <- [0 .. 3]
    , c3 <- [0 .. 3]]
    $ \idx @ (l, c1, c2, c3) -> do
      x <- readArray dp idx
      case x of
        0 -> return ()
        _ -> solve dp idx
  as <- forM [(c1, c2, c3) | c3 <- [0 .. 3], c2 <- [0 .. 3], c1 <- [0 .. 3]]
    $ \(a, b, c) -> do
      readArray dp (n, a, b, c)
  print (sum as `mod` md)
