N = gets.to_i
 
#禁止されるパターン
# (AGCT) = (0123)として
# .012, .102, .021, 0.12, 01.2の5パターン
 
dp = Array.new(N+1){Array.new(4){Array.new(4){Array.new(4,0)}}}
 
#初期化。012,102,021の3パターンが禁止
4.times do |p3|
  4.times do |p2|
    4.times do |p1|
      if ![p3,p2,p1].join.match(/012|102|021/)
        dp[3][p3][p2][p1] = 1
      end
    end
  end
end
 
 
(3..N-1).each do |n|
  4.times do |p3|
    4.times do |p2|
      4.times do |p1|
        4.times do |a|
          if ![p3,p2,p1,a].join.match(/.012|.102|.021|0.12|01.2/)
            dp[n+1][p2][p1][a] += dp[n][p3][p2][p1]
            dp[n+1][p2][p1][a] %= (10**9+7)
          end
        end
      end
    end
  end
end
 
cnt = 0
4.times do |p3|
  4.times do |p2|
    4.times do |p1|
      cnt += dp[N][p3][p2][p1]
      cnt %= (10**9 + 7)
    end
  end
end
 
p cnt