def main():

    n = int(eval(input()))

    s = eval(input())

    divider = pow(10, 9) + 7

    if s[0] == "W" or s[2 * n - 1] == "W":

        print((0))

        return

    lr = [True]

    for i in range(1, 2 * n - 1):

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

            lr.append(not lr[i - 1])

        else:

            lr.append(lr[i - 1])

    lr.append(False)

    ret = 1

    cnt = 0

    for i in range(2 * n):

        if lr[i]:

            cnt += 1

        else:

            ret *= cnt

            ret %= divider

            cnt -= 1

    if not cnt == 0:

        print((0))

        return

    for i in range(n):

        ret *= i + 1

        ret %= divider

    print(ret)

    return





if __name__ == "__main__":

    main()

def main():

    n = int(eval(input()))

    s = eval(input())

    divider = pow(10, 9) + 7

    if s[0] == "W" or s[2 * n - 1] == "W":

        print((0))

        return

    flag = True

    cnt = 1

    ret = 1

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

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

            flag = not flag

        if flag:

            cnt += 1

        else:

            ret *= cnt

            ret %= divider

            cnt -= 1

    if not cnt == 0:

        print((0))

        return

    for i in range(n):

        ret *= i + 1

        ret %= divider

    print(ret)

    return





if __name__ == "__main__":

    main()

def main():
    n = int(eval(input()))
    s = eval(input())
    divider = pow(10, 9) + 7
    if s[0] == "W" or s[2 * n - 1] == "W":
        print((0))
        return
    lr = [True]
    for i in range(1, 2 * n - 1):
        if s[i - 1] == s[i]:
            lr.append(not lr[i - 1])
        else:
            lr.append(lr[i - 1])
    lr.append(False)
    ret = 1
    cnt = 0
    for i in range(2 * n):
        if lr[i]:
            cnt += 1
        else:
            ret *= cnt
            ret %= divider
            cnt -= 1
    if not cnt == 0:
        print((0))
        return
    for i in range(n):
        ret *= i + 1
        ret %= divider
    print(ret)
    return


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    s = eval(input())
    divider = pow(10, 9) + 7
    if s[0] == "W" or s[2 * n - 1] == "W":
        print((0))
        return
    flag = True
    cnt = 1
    ret = 1
    for i in range(1, 2 * n):
        if s[i - 1] == s[i]:
            flag = not flag
        if flag:
            cnt += 1
        else:
            ret *= cnt
            ret %= divider
            cnt -= 1
    if not cnt == 0:
        print((0))
        return
    for i in range(n):
        ret *= i + 1
        ret %= divider
    print(ret)
    return


if __name__ == "__main__":
    main()

-    lr = [True] -    for i in range(1, 2 * n - 1): +    flag = True +    cnt = 1 +    ret = 1 +    for i in range(1, 2 * n): -            lr.append(not lr[i - 1]) -        else: -            lr.append(lr[i - 1]) -    lr.append(False) -    ret = 1 -    cnt = 0 -    for i in range(2 * n): -        if lr[i]: +            flag = not flag +        if flag: