#ABC122-D
MOD = 1000000007
n = gets.to_i
cnt = 1
map = ["A","G","C","T"]
hash = Hash.new(0)
map.repeated_permutation(3) do |x|
  str = x[0] + x[1] + x[2]
  if str =~ /GAC/ || str =~ /ACG/ || str =~ /AGC/
    hash[str] = 0
  else
    hash[str] = 1
  end
end
4.upto(n) do |i|
  hash2 = Hash.new(0)
  hash.each do |k,v|
    map.each do |s|
      str = k[0]+k[1]+k[2] + s
      if str =~ /GAC/ || str =~ /ACG/ || str =~ /AGC/ || str =~ /A.GC|AG.C/
        next
      else
        hash2[k[1]+k[2]+s] += v
        hash2[k[1]+k[2]+s] %= MOD
      end
    end
  end
  hash = hash2
end
puts hash.each_value.inject(:+) % MOD