#include <iostream>
#include <string>

using namespace std;

const int MOD = 1000000007;

int solve(const string& s){
    const int N = s.size()/2;
    long long res = 1;
    int numS = 0, sumS = 0, inc = 0;
    for(auto& c : s){
        if(c == 'B'){
            if(inc%2 == 0){
                ++inc;
                ++numS;
                ++sumS;
            } else {
                if(numS == 0) return 0;
                --inc;
                res = (res * numS) % MOD;
                --numS;
            }
        } else {
            if(inc%2 == 0){
                if(numS == 0) return 0;
                --inc;
                res = (res * numS) % MOD;
                --numS;
            } else {
                ++inc;
                ++numS;
                ++sumS;
            }
        }
    }
    if(sumS != N) return 0;
    for(int i=1;i<=N;i++) res = (res*i)%MOD;
    return res;
}

int main(){
    int N;
    while(cin >> N){
        string s; cin >> s;
        cout << solve(s) << endl;
    }
}
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

const int MOD = 1e9+7;

int main(){
    ll N;
    string S;
    cin >> N >> S;
    int ok = 1;
    vector<ll> A(2*N);
    A[0]=1;
    //L==1,R==0
    for(int i=1;i<2*N;i++){
        if(S[i]!=S[i-1])A[i]=A[i-1];
        else A[i]=1-A[i-1];
    }
    if(A[2*N-1]==1)ok = 0;
    if(S[0]=='W'&&S[2*N-1]=='W')ok=0;
    int num = 0;
    ll res = 1;
    for(int i=2*N-1;i>=0;i--){
        if(A[i]==0)num++;
        else{
            res*=num;
            res%=MOD;
            num--;
        }
    }
    if(num!=0)ok=0;
    ll facN = 1;
    for(int i=1;i<=N;i++){
        facN*=i;
        facN%=MOD;
    }
    if(ok)cout << (res*facN)%MOD << endl;
    else cout << 0 << endl;
    return 0;
}