mod = 10 ** 9 + 7

TTT = "TTT".freeze
AGC = "AGC".freeze
AGCT = "AGCT".freeze

n = gets.to_s.to_i

dp = Array.new(n+1){ Hash.new(0) }
dp[0][TTT] = 1

n.times do |i|
  
  dp[i].each do |(k, v)|
    
    x, y, z = k.chars
    AGCT.each_char do |c|
      
      next if (x+y+z+c)[AGC]
      next if (y+x+z+c)[AGC]
      next if (x+z+y+c)[AGC]
      next if (x+y+c+z)[AGC]
      
      s = y + z + c
      dp[i+1][s] += v
      dp[i+1][s] %= mod if dp[i+1][s] >= mod
    end
  end
end

ans = dp[n].values.reduce(0){|s,t| s+t } % mod

puts ans