n = gets.to_i

zero = (%w(A C G T).product(*([%w(A C G T)] * 2)).map(&:join) - %w(AGC ACG GAC)).map do |str|
  [str, 0]
end.to_h

hash = Hash.new do |h, i|
  ret = zero.dup
  h[i-1].each do |k, v|
    %w(A C G T).each do |c|
      str = "#{k}#{c}"
      unless [/AGC/, /ACG/, /GAC/, /AG.C/, /A.GC/].any? {|reg| str =~ reg}
        ret[str[1..-1]] += v
      end
    end
  end
  h[i] = ret
end

hash[3] = (%w(A C G T).product(*([%w(A C G T)] * 2)).map(&:join) - %w(AGC ACG GAC)).map do |str|
  [str, 1]
end.to_h

ans = hash[n].inject(0) {|memo, (key, value)| memo + value}

puts (ans % (10**9 + 7))
