N = gets.to_i
MOD = 10 ** 9 + 7

dp = Hash.new(0)

['A', 'G', 'C', 'T'].repeated_permutation(3) do |w|
	word = w.join('')
	if !(word == 'AGC' || word == 'GAC' || word == 'ACG')
    	dp[[3, word]] = 1
    end
end
4.upto(N) do |i|
	['A', 'G', 'C', 'T'].repeated_permutation(4) do |w|
		word = w.join('')
    	words = [word]
   		0.upto(2) do |l|
    		n = w.clone
   			n[l], n[l + 1] = n[l + 1], n[l]
    		words.push(n.join(''))
    	end
    	if !(words.any?{|n| n.include?('AGC')})
    		dp[[i, word[1..3]]] += dp[[i - 1, word[0..2]]]
            dp[[i, word[1..3]]] %= MOD
    	end
    end
end
  
p dp.to_a.select{|k| k[0][0] == N}.collect{|v| v[1]}.inject(:+) % MOD