N = int(eval(input()))

S = list(eval(input()))



for i in range(2*N):

    if (2*N-i)%2==1:

        S[i] = 'B' if S[i]=='W' else 'W'

        

if S.count('B')!=N:

    print((0))

    exit()



ans = 1

MOD = 10**9+7

B = 0



for Si in S:

    if Si=='B':

        B += 1

    else:

        ans *= B

        ans %= MOD

        B -= 1



fact = [1]



for i in range(1, N+1):

    fact.append(fact[-1]*i%MOD)



ans *= fact[N]

ans %= MOD



print(ans)
import sys

input = sys.stdin.readline

from collections import *



N = int(eval(input()))

S = input()[:-1]



if S[0]=='W':

    print((0))

    exit()

    

l = [0]

ans = 1

MOD = 10**9+7



for i in range(1, 2*N):

    if S[i]==S[i-1]:

        l.append(1^l[-1])

    else:

        l.append(l[-1])



if l.count(0)!=N:

    print((0))

    exit()

    

zero = 0



for li in l:

    if li==0:

        zero += 1

    else:

        ans *= zero

        ans %= MOD

        zero -= 1

        

for i in range(1, N+1):

    ans *= i

    ans %= MOD



print(ans)
N = int(eval(input()))
S = list(eval(input()))
for i in range(2 * N):
    if (2 * N - i) % 2 == 1:
        S[i] = "B" if S[i] == "W" else "W"
if S.count("B") != N:
    print((0))
    exit()
ans = 1
MOD = 10**9 + 7
B = 0
for Si in S:
    if Si == "B":
        B += 1
    else:
        ans *= B
        ans %= MOD
        B -= 1
fact = [1]
for i in range(1, N + 1):
    fact.append(fact[-1] * i % MOD)
ans *= fact[N]
ans %= MOD
print(ans)

import sys

input = sys.stdin.readline
from collections import *

N = int(eval(input()))
S = input()[:-1]
if S[0] == "W":
    print((0))
    exit()
l = [0]
ans = 1
MOD = 10**9 + 7
for i in range(1, 2 * N):
    if S[i] == S[i - 1]:
        l.append(1 ^ l[-1])
    else:
        l.append(l[-1])
if l.count(0) != N:
    print((0))
    exit()
zero = 0
for li in l:
    if li == 0:
        zero += 1
    else:
        ans *= zero
        ans %= MOD
        zero -= 1
for i in range(1, N + 1):
    ans *= i
    ans %= MOD
print(ans)

+import sys + +input = sys.stdin.readline +from collections import * + -S = list(eval(input())) -for i in range(2 * N): -    if (2 * N - i) % 2 == 1: -        S[i] = "B" if S[i] == "W" else "W" -if S.count("B") != N: +S = input()[:-1] +if S[0] == "W": +l = [0] -B = 0 -for Si in S: -    if Si == "B": -        B += 1 +for i in range(1, 2 * N): +    if S[i] == S[i - 1]: +        l.append(1 ^ l[-1]) -        ans *= B +        l.append(l[-1]) +if l.count(0) != N: +    print((0)) +    exit() +zero = 0 +for li in l: +    if li == 0: +        zero += 1 +    else: +        ans *= zero -        B -= 1 -fact = [1] +        zero -= 1 -    fact.append(fact[-1] * i % MOD) -ans *= fact[N] -ans %= MOD +    ans *= i +    ans %= MOD