MOD = 10**9+7

def ok?(i,j,k,l)
  if i ==1 && l== 3 && (j == 2 || k == 2)
    return false
  end

  s = "#{j}#{k}#{l}"

  if s.include?("123") || s.include?("132") || s.include?("213")
    return false
  end

  return true
end

N = gets.to_i

dp = Array.new(N+1) {Array.new(4){Array.new(4){Array.new(4,0)}}}
#dp[n][i][j][k] は，末尾がijkで条件をみたすn文字の場合の数
#i,j,k は0,1,2,3のときT,A,G,Cにそれぞれ対応

dp[0][0][0][0] = 1

for n in 1..N do
  for i in 0..3 do
    for j in 0..3 do
      for k in 0..3 do
        for l in 0..3 do
          if ok?(i,j,k,l)
            dp[n][j][k][l] += dp[n-1][i][j][k] % MOD
          end
        end
      end
    end
  end
end

ans = 0

for i in 0..3 do
  for j in 0..3 do
    for k in 0..3 do
      ans += dp[N][i][j][k] % MOD
    end
  end
end

puts ans
