#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc() {
    return getchar();
    static char buf[100000], *l = buf, *r = buf;
    return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
    x = 0; int f = 1, ch = nc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
    while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
    x *= f;
}
typedef long long LL;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 50;
int n;
char s[maxn];
int a[maxn];
int solve() {
    n <<= 1;
    for(int i = 1; i <= n; ++i) {
        a[i] = s[i] == 'B';
    }
    for(int i = n; i >= 1; --i) {
        a[i] ^= a[i - 1];
    }
    a[0] = 1;
    for(int i = 1; i <= n; ++i) {
        a[i] ^= a[i - 1] ^ 1;
    }
    int an = 1, cnt = 0;
    for(int i = 1; i <= n; ++i) {
        if(a[i]) ++cnt;
        else {
            if(cnt == 0) return 0;
            an = (LL)an * cnt % mod;
            --cnt;
        }
    }
    if(cnt) return 0;
    n >>= 1;
    for(int i = 1; i <= n; ++i) {
        an = (LL)an * i % mod;
    }
    return an;
}
int main() {
    read(n);
    scanf("%s", s + 1);
    printf("%d\n", solve());
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define vc vector
#define sz(v) (int)(v).size()
#define pb push_back
#define FF first
#define SS second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define pll pair<ll,ll>
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
typedef long double f80;
#define endl '\n'

const int mod = 1e9 + 7;
const int N = 2e5 + 5;
char s[N];
bool x[N];

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	fr(i, 1, 2 * n) {
		cin >> s[i];
	}
	int ans = 1;
	fr(i, 1, n) {
		ans = (ans * 1LL * i) % mod;
	}
	s[0] = 'W';
	s[2 * n + 1] = 'W';
	fr(i, 0, 2 * n) {
		if(s[i] != s[i + 1])
			x[i] = 1;
	}
	int cl = 0, cr = 0, val = 0;
	bool pos = 1;
	fr(i, 1, 2 * n) {
		if(x[i - 1]) {
			cl++;
			val++;
		}
		else {
			x[i] ^= 1;
			cr++;
			if(!val) pos = 0;
			ans = (ans * 1LL * val) % mod;
			val--;
		}
	}
	if(!pos || (cl != cr && cl != n)) {
		cout << 0;
		return 0;
	}
	cout << ans;
	return 0;
}