module Factwithmod
  implicit none
  integer(16),allocatable,dimension(:)::Kaijo
  contains
subroutine initiationFactorial(maxnum,mo)
  implicit none
  integer(16)::maxnum
  integer(16)::mo
  integer(16)::i

  allocate(Kaijo(0:maxnum))
  Kaijo(0)=1
  do i=1,maxnum
    Kaijo(i)=mod(Kaijo(i-1)*i,mo)
  end do
end subroutine

function combination(n,k,l)
implicit none
integer(16),intent(in)::n,k,l
integer combination

combination=mod(Kaijo(N)*inv(Kaijo(K),l)*inv(Kaijo(N-K),l),l)

end function

function inv(K,L)
integer(16),intent(in)::k,l
integer(16) l2,y
integer(16) inv
inv=1
l2=l-2
y=k
do
  if(mod(l2,2)==1)inv=mod(inv*y,l)
  y=mod(y*y,l)
  l2=l2/2
  if(l2==0)exit
end do
end function

function permutation(n,k,mo)
implicit none
  integer(16)::n,k
  integer(16)::mo,permutation
  permutation=mod(Kaijo(N)*inv(Kaijo(N-K),mo),mo)
end function
end module

use Factwithmod
integer(16) N
character(200000) S
integer(16) match,cntmatch
integer(16)ans,mo,i
mo=10**9+7
read*,N
read*,S
call initiationFactorial(N,mo)
match=0
cntmatch=0
ans=1
do i=1,2*N
  if(mod(I,2)==1)then
    if(S(I:I)=="B")then
      match=match+1
      cntmatch=cntmatch+1
    else
      ans=ans*match
      match=match-1
    endif
  else
    if(S(I:I)=="W")then
      match=match+1
      cntmatch=cntmatch+1
    else
      ans=mod(ans*match,mo)
      match=match-1
    endif
  end if
end do
if(cntmatch/=N)ans=0
ans=mod(ans*kaijo(N),mo)
print"(I0)",ans
end