def we_like_agc(n)
  dp = Array.new(n + 1) do
    Array.new(4) do
      Array.new(4) do
        Array.new(4, 0)
      end
    end
  end

  dp[0][3][3][3] = 1

  0.upto(n - 1) do |len|
    0.upto(3) do |c1|
      0.upto(3) do |c2|
        0.upto(3) do |c3|
          next if dp[len][c1][c2][c3] == 0

          0.upto(3) do |a|
            next if a == 2 && c1 == 1 && c2 == 0
            next if a == 2 && c1 == 0 && c2 == 1
            next if a == 1 && c1 == 2 && c2 == 0
            next if a == 2 && c1 == 1 && c3 == 0
            next if a == 2 && c2 == 1 && c3 == 0

            dp[len + 1][a][c1][c2] += dp[len][c1][c2][c3]
          end
        end
      end
    end
  end

  ans = 0
  0.upto(3) do |c1|
    0.upto(3) do |c2|
      0.upto(3) do |c3|
        ans += dp[n][c1][c2][c3]
      end
    end
  end

  ans % (10 ** 9 + 7)
end

p we_like_agc(gets.to_i)