MOD = 1000_000_007
n = gets.to_i
dp=(0..n).map{{}}
dp[0]['TTT'] = 1
n.times do |i|
  dp[i].each do |k, v|
    'AGCT'.chars do |c|
      s = "#{k}#{c}"
      next if ["AGC", "ACG", "GAC"].include?(s[1..3])
      next if s[0..1] == "AG" && s[3] == "C"
      next if s[0] == "A" && s[2..3] == "GC"
      dp[i+1][s[1..3]] = dp[i+1][s[1..3]].to_i + v
      dp[i+1][s[1..3]] %= MOD
    end
  end
end
p dp[n].values.inject(:+) % MOD