import Data.Map ((!))
import qualified Data.Map as M

main = readLn>>=print.solve

solve :: Int -> Int
solve n = M.foldr (+%) 0 $ ans !! n
  where
  ans = replicate 3 M.empty
        ++ M.fromList [([a,b,c],1)
                      | a<-"ACGT", b<-"ACGT", c<-"ACGT"
                      , [a,b,c] `notElem` ["AGC","ACG","GAC"] ]
         : map f (drop 3 ans)
  f pMap = foldl g M.empty [[a,b,c,d] | a<-"ACGT", b<-"ACGT", c<-"ACGT", d<-"ACGT"]
    where
    g cMap ['A','G','C', _ ] = cMap
    g cMap [ _ ,'A','G','C'] = cMap
    g cMap ['A','C','G', _ ] = cMap
    g cMap [ _ ,'A','C','G'] = cMap
    g cMap ['G','A','C', _ ] = cMap
    g cMap [ _ ,'G','A','C'] = cMap
    g cMap ['A', _ ,'G','C'] = cMap
    g cMap ['A','G', _ ,'C'] = cMap
    g cMap head4 = M.insertWith (+%) (init head4) (pMap!tail head4) cMap

a +% b = mod (a+b) 1000000007