#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


// ref : https://atcoder.jp/contests/jsc2019-qual/submissions/16521703

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t;
    char c = 'W';
    rep(i, 2 * n){
        if (s[i] != c){
            t += 'L';
            if (c == 'W') c = 'B';
            else c = 'W';
        }
        else {
            t += 'R';
            if (c == 'W') c = 'B';
            else c = 'W';
        }
    }
    
   int cnt = 0;
    rep(i, 2 * n) cnt += (t[i] == 'L');
    if (cnt != n) {
        cout << 0 << endl;
        return 0;
    }
    
    ll ans = 1;
    ll l = 0;
    rep(i, 2 * n){
        if (t[i] == 'L'){
            l++;
        }
        else {
            ans *= l;
            ans %= MOD;
            l--;
        }
    }

    for(ll i = 1; i <= n; i++){
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef int_fast64_t ll;

template<int N, typename T, T M>
struct ModFact {
    T fact[N+1];
    constexpr ModFact() : fact() {
        fact[0] = 1;
        for (int i=0; i<N; ++i)
            fact[i+1] = (fact[i]*(i+1))%M;
    }
};
 
ModFact<100000, ll, MOD> fact;

ll N, M, ans = 1;
int tmp, cnt = 0;
constexpr ll th = 1LL<<45;
char S[200000];

int main() {
    scanf("%lld\n", &N);
    M = N << 1;
    fread_unlocked(S, 1, M, stdin);
	for(size_t i = 0; i < M;) {
		tmp = (S[i++]=='B') + cnt;
		if(tmp&1) cnt++;
		else {
            ans *= cnt;
            if(ans > th) ans %= MOD;
            if(--cnt < 0) break;
        } 
	}
    ans = cnt == 0 ? ((ans % MOD) * fact.fact[N]) % MOD : 0;
    printf("%lld\n", ans);
    return 0;
}
