n,s=open(0)

n=int(n)

a=l=s[0]<'W'>s[-2]

r=f=0

for b,c in zip(s,s[1:-1]):f^=b==c;a=a*(max(1,n))*(l-r)**f%(10**9+7);n-=1;r+=f;l+=f^1

print((a*(l==r)))
n,s=open(0)

n=int(n)

a=l=s[0]<'W'>s[-2]

r=f=0

for b,c in zip(s,s[1:-1]):f^=b==c;a=a*(n<1or n)*(l-r)**f%(10**9+7);n-=1;r+=f;l+=f^1

print((a*(l==r)))
n, s = open(0)
n = int(n)
a = l = s[0] < "W" > s[-2]
r = f = 0
for b, c in zip(s, s[1:-1]):
    f ^= b == c
    a = a * (max(1, n)) * (l - r) ** f % (10**9 + 7)
    n -= 1
    r += f
    l += f ^ 1
print((a * (l == r)))

n, s = open(0)
n = int(n)
a = l = s[0] < "W" > s[-2]
r = f = 0
for b, c in zip(s, s[1:-1]):
    f ^= b == c
    a = a * (n < 1 or n) * (l - r) ** f % (10**9 + 7)
    n -= 1
    r += f
    l += f ^ 1
print((a * (l == r)))

-    a = a * (max(1, n)) * (l - r) ** f % (10**9 + 7) +    a = a * (n < 1 or n) * (l - r) ** f % (10**9 + 7)