import sys

from math import factorial



N = int(eval(input()))

S = eval(input())

mod = 10**9+7



if S[0] == 'W' or S[-1] == 'W':

    print((0))

    sys.exit()



op = "L"

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

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

        op += 'R' if op[i-1] == 'L' else 'L'

    else:

        op += 'R' if op[i-1] == 'R' else 'L'



if op.count('L') != N:

    print((0))

    sys.exit()



ct_L, ans = 0, 1



for i in op:

    if i == 'L':

        ct_L += 1

    else:

        ans *= ct_L

        ct_L -= 1

    ans %= mod





print((factorial(N) * ans % mod))

import sys





def factorial(N: int, mod: int) -> int:

    res = 1

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

        res *= i

        res %= mod

    return res





N = int(eval(input()))

S = eval(input())

mod = 10**9+7



if S[0] == 'W' or S[-1] == 'W':

    print((0))

    sys.exit()



op = [0]*(2*N)

op[0] = False

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

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

        op[i] = True if op[i-1] is False else False

    else:

        op[i] = True if op[i-1] is True else False



if op.count(True) != N:

    print((0))

    sys.exit()



ans = 1

L_ct = 0

R_ct = 0

for i in op:

    if i:

        ans *= L_ct

        L_ct -= 1

    else:

        L_ct += 1

    ans %= mod



print((factorial(N, mod) * ans % mod))

import sys
from math import factorial

N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
if S[0] == "W" or S[-1] == "W":
    print((0))
    sys.exit()
op = "L"
for i in range(1, 2 * N):
    if S[i] == S[i - 1]:
        op += "R" if op[i - 1] == "L" else "L"
    else:
        op += "R" if op[i - 1] == "R" else "L"
if op.count("L") != N:
    print((0))
    sys.exit()
ct_L, ans = 0, 1
for i in op:
    if i == "L":
        ct_L += 1
    else:
        ans *= ct_L
        ct_L -= 1
    ans %= mod
print((factorial(N) * ans % mod))

import sys


def factorial(N: int, mod: int) -> int:
    res = 1
    for i in range(1, N + 1):
        res *= i
        res %= mod
    return res


N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
if S[0] == "W" or S[-1] == "W":
    print((0))
    sys.exit()
op = [0] * (2 * N)
op[0] = False
for i in range(1, 2 * N):
    if S[i] == S[i - 1]:
        op[i] = True if op[i - 1] is False else False
    else:
        op[i] = True if op[i - 1] is True else False
if op.count(True) != N:
    print((0))
    sys.exit()
ans = 1
L_ct = 0
R_ct = 0
for i in op:
    if i:
        ans *= L_ct
        L_ct -= 1
    else:
        L_ct += 1
    ans %= mod
print((factorial(N, mod) * ans % mod))

-from math import factorial + + +def factorial(N: int, mod: int) -> int: +    res = 1 +    for i in range(1, N + 1): +        res *= i +        res %= mod +    return res + -op = "L" +op = [0] * (2 * N) +op[0] = False -        op += "R" if op[i - 1] == "L" else "L" +        op[i] = True if op[i - 1] is False else False -        op += "R" if op[i - 1] == "R" else "L" -if op.count("L") != N: +        op[i] = True if op[i - 1] is True else False +if op.count(True) != N: -ct_L, ans = 0, 1 +ans = 1 +L_ct = 0 +R_ct = 0 -    if i == "L": -        ct_L += 1 +    if i: +        ans *= L_ct +        L_ct -= 1 -        ans *= ct_L -        ct_L -= 1 +        L_ct += 1 -print((factorial(N) * ans % mod)) +print((factorial(N, mod) * ans % mod))