MOD = 1_000_000_007
io = STDIN
N=io.gets.to_i
$memo=Array.new(N+1){{}}
def check(last4)
  return false if last4.index("AGC")
  (0..3).each_cons(2) do |i,j|
    s=last4.clone
    s[i],s[j]=s[j],s[i]
    return false if s.index("AGC")
  end
  true
end
def dfs(i,last3)
  return $memo[i][last3] if $memo[i].has_key?(last3)
  return 1 if i==N
  cnt=0
  'ACGT'.each_char do |c|
    cnt += dfs(i+1,last3[1..-1]+c) if check(last3+c)
  end
  $memo[i][last3] = cnt % MOD
end
puts dfs(0,"TTT")
