import sys



sys.setrecursionlimit(10 ** 7)





def fact(x):

    if x == 0:

        return 1

    else:

        return x * fact(x - 1) % mod





mod = 10 ** 9 + 7



n = int(eval(input()))

s = eval(input())

t = list([1 if x == 'B' else 0 for x in s])

t = tuple((tt - df) % 2 for tt, df in zip(t, reversed(list(range(n * 2)))))

# print(t)



zeros = 0

ans = 1

ones = 0

for tt in t:

    if tt == 0:

        zeros += 1

    else:

        if zeros == 0:

            print((0))

            exit()

        ans *= zeros

        ans %= mod

        zeros -= 1

        ones += 1



if zeros > 0:

    ans = 0



ans *= fact(ones)

ans %= mod

print(ans)

mod = 10 ** 9 + 7



n = int(eval(input()))

s = eval(input())

t = list([1 if x == 'B' else 0 for x in s])

t = tuple((tt - df) % 2 for tt, df in zip(t, reversed(list(range(n * 2)))))

# print(t)



ans = 1

zeros = 0

ones = 0

for tt in t:

    if tt == 0:

        zeros += 1

    else:

        if zeros == 0:

            print((0))

            exit()

        ans *= zeros

        ans %= mod

        zeros -= 1

        ones += 1



if zeros > 0:

    print((0))

    exit()



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

    ans *= i

    ans %= mod



print(ans)

import sys

sys.setrecursionlimit(10**7)


def fact(x):
    if x == 0:
        return 1
    else:
        return x * fact(x - 1) % mod


mod = 10**9 + 7
n = int(eval(input()))
s = eval(input())
t = list([1 if x == "B" else 0 for x in s])
t = tuple((tt - df) % 2 for tt, df in zip(t, reversed(list(range(n * 2)))))
# print(t)
zeros = 0
ans = 1
ones = 0
for tt in t:
    if tt == 0:
        zeros += 1
    else:
        if zeros == 0:
            print((0))
            exit()
        ans *= zeros
        ans %= mod
        zeros -= 1
        ones += 1
if zeros > 0:
    ans = 0
ans *= fact(ones)
ans %= mod
print(ans)

mod = 10**9 + 7
n = int(eval(input()))
s = eval(input())
t = list([1 if x == "B" else 0 for x in s])
t = tuple((tt - df) % 2 for tt, df in zip(t, reversed(list(range(n * 2)))))
# print(t)
ans = 1
zeros = 0
ones = 0
for tt in t:
    if tt == 0:
        zeros += 1
    else:
        if zeros == 0:
            print((0))
            exit()
        ans *= zeros
        ans %= mod
        zeros -= 1
        ones += 1
if zeros > 0:
    print((0))
    exit()
for i in range(1, n + 1):
    ans *= i
    ans %= mod
print(ans)

-import sys - -sys.setrecursionlimit(10**7) - - -def fact(x): -    if x == 0: -        return 1 -    else: -        return x * fact(x - 1) % mod - - +ans = 1 -ans = 1 -    ans = 0 -ans *= fact(ones) -ans %= mod +    print((0)) +    exit() +for i in range(1, n + 1): +    ans *= i +    ans %= mod