from heapq import heappush, heappop

from collections import deque,defaultdict,Counter

from itertools import permutations,groupby

import sys

import bisect

import string

alp=string.ascii_lowercase

sys.setrecursionlimit(10**6)

def SI():

    return input().split()

def MI():

    return list(map(int,input().split()))

def I():

    return int(eval(input()))

def LI():

    return [int(i) for i in input().split()]

YN=['Yes','No']

mo=10**9+7

#mo=998244353

#input=sys.stdin.readline



n=I()

s=list(eval(input()))

ans=0

t=[]

l,r=0,0

for i in range(n*2):

    if i==0:

        t+=['L']

        l+=1

        continue

    if ((l-r)%2==1 and s[i]=='W') or ((l-r)%2==0 and s[i]=='B'):

        t+=['L']

        l+=1

    else:

        t+=['R']

        r+=1

if t.count('L')!=n:

    print((0))

    exit()

    

#print(s,t)

L,R=0,0

ans=1

for i in t:

    if i=='L':

        L+=1

    if i=='R':

        ans*=L-R

        ans%=mo

        R+=1

f=1

for i in range(2,n+1):

    f*=i

    f%=mo

print(((ans*f)%mo))



from heapq import heappush,heappop,heapify

from collections import deque,defaultdict,Counter

import itertools

from itertools import permutations,combinations,groupby

import sys

import bisect

import string

import math

import time

import random

def I():

    return int(input())

def MI():

    return map(int,input().split())

def LI():

    return [int(i) for i in input().split()]

def LI_():

    return [int(i)-1 for i in input().split()]

def StoI():

    return [ord(i)-97 for i in input()]

def ItoS(nn):

    return chr(nn+97)

def GI(V,E,Directed=False,index=0):

    org_inp=[]

    g=[[] for i in range(n)]

    for i in range(E):

        inp=LI()

        org_inp.append(inp)

        if index==0:

            inp[0]-=1

            inp[1]-=1

        if len(inp)==2:

            a,b=inp

            g[a].append(b)

            if not Directed:

                g[b].append(a)

        elif len(inp)==3:

            a,b,c=inp

            aa=(inp[0],inp[2])

            bb=(inp[1],inp[2])

            g[a].append(bb)

            if not Directed:

                g[b].append(aa)

    return g,org_inp

def bit_combination(k,n=2):

    rt=[]

    for tb in range(n**k):

        s=[tb//(n**bt)%n for bt in range(k)]

        rt+=[s]

    return rt

def show(*inp,end='\n'):

    if show_flg:

        print(*inp,end=end)

YN=['Yes','No']

mo=10**9+7

inf=float('inf')

l_alp=string.ascii_lowercase

u_alp=string.ascii_uppercase

ts=time.time()

#sys.setrecursionlimit(10**5)

input=lambda: sys.stdin.readline().rstrip()



def ran_input():

    import random

    n=random.randint(4,16)

    rmin,rmax=1,10

    a=[random.randint(rmin,rmax) for _ in range(n)]

    return n,a



show_flg=False

show_flg=True



ans=1



n=I()

s=input()

l,r=0,0



for i in range(n*2):

    t=1 if s[i]=='B' else 0

    if (l-r+t)%2==1:

        l+=1

    else:

        ans*=(l-r)

        ans%=mo

        r+=1

    if i>=n:

        ans*=i-n+1

        ans%=mo

if r-l!=0:

    print(0)

else:

    print(ans)

from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
from itertools import permutations, groupby
import sys
import bisect
import string

alp = string.ascii_lowercase
sys.setrecursionlimit(10**6)


def SI():
    return input().split()


def MI():
    return list(map(int, input().split()))


def I():
    return int(eval(input()))


def LI():
    return [int(i) for i in input().split()]


YN = ["Yes", "No"]
mo = 10**9 + 7
# mo=998244353
# input=sys.stdin.readline
n = I()
s = list(eval(input()))
ans = 0
t = []
l, r = 0, 0
for i in range(n * 2):
    if i == 0:
        t += ["L"]
        l += 1
        continue
    if ((l - r) % 2 == 1 and s[i] == "W") or ((l - r) % 2 == 0 and s[i] == "B"):
        t += ["L"]
        l += 1
    else:
        t += ["R"]
        r += 1
if t.count("L") != n:
    print((0))
    exit()
# print(s,t)
L, R = 0, 0
ans = 1
for i in t:
    if i == "L":
        L += 1
    if i == "R":
        ans *= L - R
        ans %= mo
        R += 1
f = 1
for i in range(2, n + 1):
    f *= i
    f %= mo
print(((ans * f) % mo))

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return [int(i) for i in input().split()]


def LI_():
    return [int(i) - 1 for i in input().split()]


def StoI():
    return [ord(i) - 97 for i in input()]


def ItoS(nn):
    return chr(nn + 97)


def GI(V, E, Directed=False, index=0):
    org_inp = []
    g = [[] for i in range(n)]
    for i in range(E):
        inp = LI()
        org_inp.append(inp)
        if index == 0:
            inp[0] -= 1
            inp[1] -= 1
        if len(inp) == 2:
            a, b = inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp) == 3:
            a, b, c = inp
            aa = (inp[0], inp[2])
            bb = (inp[1], inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g, org_inp


def bit_combination(k, n=2):
    rt = []
    for tb in range(n**k):
        s = [tb // (n**bt) % n for bt in range(k)]
        rt += [s]
    return rt


def show(*inp, end="\n"):
    if show_flg:
        print(*inp, end=end)


YN = ["Yes", "No"]
mo = 10**9 + 7
inf = float("inf")
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**5)
input = lambda: sys.stdin.readline().rstrip()


def ran_input():
    import random

    n = random.randint(4, 16)
    rmin, rmax = 1, 10
    a = [random.randint(rmin, rmax) for _ in range(n)]
    return n, a


show_flg = False
show_flg = True
ans = 1
n = I()
s = input()
l, r = 0, 0
for i in range(n * 2):
    t = 1 if s[i] == "B" else 0
    if (l - r + t) % 2 == 1:
        l += 1
    else:
        ans *= l - r
        ans %= mo
        r += 1
    if i >= n:
        ans *= i - n + 1
        ans %= mo
if r - l != 0:
    print(0)
else:
    print(ans)

-from heapq import heappush, heappop +from heapq import heappush, heappop, heapify -from itertools import permutations, groupby +import itertools +from itertools import permutations, combinations, groupby - -alp = string.ascii_lowercase -sys.setrecursionlimit(10**6) +import math +import time +import random -def SI(): -    return input().split() +def I(): +    return int(input()) -    return list(map(int, input().split())) - - -def I(): -    return int(eval(input())) +    return map(int, input().split()) +def LI_(): +    return [int(i) - 1 for i in input().split()] + + +def StoI(): +    return [ord(i) - 97 for i in input()] + + +def ItoS(nn): +    return chr(nn + 97) + + +def GI(V, E, Directed=False, index=0): +    org_inp = [] +    g = [[] for i in range(n)] +    for i in range(E): +        inp = LI() +        org_inp.append(inp) +        if index == 0: +            inp[0] -= 1 +            inp[1] -= 1 +        if len(inp) == 2: +            a, b = inp +            g[a].append(b) +            if not Directed: +                g[b].append(a) +        elif len(inp) == 3: +            a, b, c = inp +            aa = (inp[0], inp[2]) +            bb = (inp[1], inp[2]) +            g[a].append(bb) +            if not Directed: +                g[b].append(aa) +    return g, org_inp + + +def bit_combination(k, n=2): +    rt = [] +    for tb in range(n**k): +        s = [tb // (n**bt) % n for bt in range(k)] +        rt += [s] +    return rt + + +def show(*inp, end="\n"): +    if show_flg: +        print(*inp, end=end) + + -# mo=998244353 -# input=sys.stdin.readline +inf = float("inf") +l_alp = string.ascii_lowercase +u_alp = string.ascii_uppercase +ts = time.time() +# sys.setrecursionlimit(10**5) +input = lambda: sys.stdin.readline().rstrip() + + +def ran_input(): +    import random + +    n = random.randint(4, 16) +    rmin, rmax = 1, 10 +    a = [random.randint(rmin, rmax) for _ in range(n)] +    return n, a + + +show_flg = False +show_flg = True +ans = 1 -s = list(eval(input())) -ans = 0 -t = [] +s = input() -    if i == 0: -        t += ["L"] -        l += 1 -        continue -    if ((l - r) % 2 == 1 and s[i] == "W") or ((l - r) % 2 == 0 and s[i] == "B"): -        t += ["L"] +    t = 1 if s[i] == "B" else 0 +    if (l - r + t) % 2 == 1: -        t += ["R"] +        ans *= l - r +        ans %= mo -if t.count("L") != n: -    print((0)) -    exit() -# print(s,t) -L, R = 0, 0 -ans = 1 -for i in t: -    if i == "L": -        L += 1 -    if i == "R": -        ans *= L - R +    if i >= n: +        ans *= i - n + 1 -        R += 1 -f = 1 -for i in range(2, n + 1): -    f *= i -    f %= mo -print(((ans * f) % mo)) +if r - l != 0: +    print(0) +else: +    print(ans)