M=10**9+7
V="AGC"
Swap=[[0,1,2,3],[1,0,2,3],[0,2,1,3],[0,1,3,2]]

n=gets.to_i
dp=Hash.new(0)
[?A,?G,?C,?D].repeated_permutation(2){|perm|
  dp[?.+perm.join]=1
}

(n-2).times{
  _dp=Hash.new(0)
  [?A,?G,?C,?D].each{|c|
    dp.each{|k,v|
      str=k+c
      key=str[1..3]
      strs=Swap.map{|perm|perm.map{|i|str[i]}.join}
      unless strs.any?{|s|s.index V}
        _dp[key]=(_dp[key]+v)%M
      end
    }
  }
  dp=_dp
}

puts dp.values.inject(:+)%M