#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
const long long MOD = 1000000007;
int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    
    int current_open = 0;
    long long N_fact = 1;
    for(int i = 1; i <= N; i++){
        N_fact = (N_fact * i) % MOD;
    }
    
    long long ans = 1;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'B'){
            if(current_open % 2 == 0){
                current_open ++;
            } else {
                ans = (ans * current_open) % MOD;
                current_open --;
            }
        } else {
            if(current_open % 2 == 0){
                if(current_open <= 0){
                    ans = 0;
                    break;
                } else {
                    ans = (ans * current_open) % MOD;
                    current_open --;
                }
            } else {
                current_open ++;
            }
        }
    }
    
    ans = (ans * N_fact) % MOD;

    if(current_open != 0){
        cout << 0 << endl;
    } else {
        cout << ans << endl;
    }
}
#include<iostream>
#include<cstdio>
const int N=2e5+5;
char s[N];
typedef long long ll;
const ll mod=1e9+7;
int d[N];
int main() {
    int n;
    scanf("%d",&n);
    scanf("%s",s+1);
    if(s[1]=='W') return !printf("0");
    d[1]=0;
    for(int i=2;i<=n+n;i++) {
        if(s[i]==s[i-1]) d[i]=d[i-1]^1;
        else d[i]=d[i-1];
    }
    int num[2]={0,0};
    for(int i=1;i<=n+n;i++) num[d[i]]++;
    if(num[0]!=n) return !printf("0");
    ll ans=1;
    int cnt=0;
    for(int i=1;i<=n+n;i++) {
        if(d[i]) ans=ans*cnt%mod,cnt--;
        else cnt++;
        if(cnt<0) return !printf("0");
    }
    for(int i=1;i<=n;i++) ans=ans*i%mod;
    printf("%lld\n",ans);
    return 0;
}
