/**Lucky Boy**/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 100005
#define maxm 1000006
#define pii pair <int,int>
#define Task ""
template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10);putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
template <typename T> inline void writeln(T x){write(x);putchar('\n');}
using namespace std;
int n,gt[maxn << 1],ans,cur;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    //freopen(Task".inp", "r",stdin);
    //freopens(Task".out", "w",stdout);
    cin >> n;
    n <<= 1;
    gt[0] = 1;
    FOR(i,1,n) gt[i] = (1ll*gt[i-1]*i) % maxc;
    ans = gt[n / 2];
    FOR(i,1,n)
    {
        int x;
        char c;
        cin >> c;
        x = (c == 'W');
        if (x)
        {
            if (cur & 1)
            {
                ++cur;
            }
            else
            {
                ans = (1ll*ans*cur) % maxc;
                --cur;
            }
        }
        else
        {
            if (cur & 1)
            {
                ans = (1ll*ans*cur) % maxc;
                --cur;
            }
            else
            {
                ++cur;
            }
        }
    }
    if (cur) ans = 0;
    cout << ans;
    return 0;
}

#include <algorithm>
#include <iostream>
#include <string.h>
#include <cstdlib>
#include <vector>
#include <string>
#include <bitset>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
 
typedef long long ll;
typedef long double ld;
 
const ll MOD = 1e9 + 7, INF = 1e18 + 1;
 
using namespace std;

ll er[1000001], p[1000000], ptr, n, d[1000][1000];

ll gcd (ll a, ll b)
{
	if (!b) return a;
	else return gcd (b, a % b);
}

int main ()
{
	for (ll i = 2; i <= 1000000; i++)
		if (!er[i])
		{
			p[ptr++] = i;
			for (ll j = i * i; j <= 1000000; j += i)
				er[j] = 1;
		}

	cin >> n;

	for (int i = 0; i < 2 * n; i += 2)
		for (int j = 0; i + j < 2 * n; j++)
			d[j][i + j] = p[i / 2];


	for (int i = 2; i < 2 * n; i += 2)
		for (int j = 0; i + j < 2 * n; j++)
			d[i + j][j] = p[i / 2 + (n + 1) / 2 - 1];


	for (int i = 0; i < 2 * n; i += 2)
		for (int j = 0; i >= j; j++)
			d[i - j][j] *= p[i / 2 + n];

	ll mx = 0;

	if (n == 2)
	{
		printf ("4 7\n23 10");
		return 0;
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (!d[i][j])
			{
				ll lcm = 1;
				if (j) lcm = lcm / gcd (lcm, d[i][j-1]) * d[i][j-1];
				if (j < n - 1) lcm = lcm / gcd (lcm, d[i][j+1]) * d[i][j+1];
				if (i) lcm = lcm / gcd (lcm, d[i-1][j]) * d[i-1][j];
				if (i < n - 1) lcm = lcm / gcd (lcm, d[i+1][j]) * d[i+1][j];

				d[i][j] = lcm + 1;
			}

			printf ("%lld ", d[i][j]);
		}
		putchar ('\n');
	}
}