n = gets.to_i
# dp[桁][二つ前][ひとつ前]
# 選ばない=0, a=1, g=2, c=3, t=4
# a=1,g=2にc=3が続いてはダメ
# g=2,a=1にc=3が続いてはダメ
# a=1,c=3にg=2が続いてはダメ
# a=1,g=2,なんとか,にc=3が続いてはダメ
# a=1,なんとか,g=2,にc=3が続いてはダメ
# あとは自由

MOD = 10**9+7
dp = Array.new(n + 1) { Array.new(1000, 0) }
dp[0][0] = 1 # [桁][直近3回の状態を3桁の10進数で]

def each_state
  5.times do |i|
    5.times do |j|
      5.times do |k|
        yield i * 10 + j, j * 10 + k, i * 100 + j * 10 + k
      end
    end
  end
end

n.times do |i|
  each_state do |s1, s2, s3|
    1.upto(4) do |v|
      next if s2 == 12 && v == 3
      next if s2 == 21 && v == 3
      next if s2 == 13 && v == 2
      next if s1 == 12 && v == 3
      next if s3 == 112 && v == 3
      next if s3 == 122 && v == 3
      next if s3 == 132 && v == 3
      next if s3 == 142 && v == 3
      ns = s2 * 10 + v
      dp[i + 1][ns] += dp[i][s3]
      dp[i + 1][ns] %= MOD
    end
  end
end

ans = dp[n].inject(0, :+)
puts ans % MOD
