
next (a,b,c,d,e,f,g,h,i) = (a',b',c',d',e',f',g',h',i') where
  a' = (b + c + d) `mod` 1000000007
  b' = (a + f + g) `mod` 1000000007
  c' = (b + h + i) `mod` 1000000007
  d' = (f + h + i) `mod` 1000000007
  e' = (f + 2*i) `mod` 1000000007
  f' = (a + e + f + g) `mod` 1000000007
  g' = (c + f + 2*i) `mod` 1000000007
  h' = (b + h + 2*i) `mod` 1000000007
  i' = (f + h + 2*i) `mod` 1000000007

solve n = let (a,b,c,d,e,f,g,h,i) = (!! (n - 3)) $ iterate next (1,1,1,1,1,1,1,1,1)
  in (4*a + 4*b + 2*c + d + 3*e + 12*f + 4*g + 9*h + 22*i) `mod` 1000000007
 
main = do
  n <- read <$> getLine
  print $ solve n
