N = gets.to_i
S = gets.chomp
if S[0] != "B" || S[-1] != "B"
  p 0; exit
end
Mod = 10**9 + 7
opened = 1
ans = 1
last_is_open = true
(1...(2*N)).each{ |i|
  if S[i-1] == S[i]
    last_is_open = !last_is_open
  else
    last_is_open = last_is_open
  end
  if last_is_open
    opened += 1
  else
    ans = ans * opened % Mod
    opened -= 1
  end
}
if opened != 0
  p 0; exit
end

p ans * (1..N).reduce(1){ |a,b| a * b % Mod } % Mod
