local mod = 1000000007

local function bmul(x, y)
  return (x * y) % mod
end

local n = io.read("*n", "*l")
local s = io.read()
local depth = 0
local f = true
local ret = 1
for i = 1, 2 * n do
  if s:sub(i, i) == "B" then
    if depth % 2 == 0 then
      depth = depth + 1
    else
      ret = bmul(ret, depth)
      depth = depth - 1
    end
  else
    if depth % 2 == 0 then
      if depth == 0 then
        f = false
        break
      else
        ret = bmul(ret, depth)
        depth = depth - 1
      end
    else
      depth = depth + 1
    end
  end
end
if 0 ~= depth then f = false end
if f then
  for i = 1, n do
    ret = bmul(ret, i)
  end
else
  ret = 0
end
print(ret)
