#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define eb emplace_back
using namespace std;
string s;
ll ans=1,cnt=0,n;
const int mod=1e9+7;
int main(){
    cin>>n>>s;
    for(auto x:s){
        if(x=='W'&&(cnt&1)){
            cnt++;
        }else if(x=='B'&&!(cnt&1)){
            cnt++;
        }else{
            (ans*=cnt)%=mod;
            cnt--;
        }
    }
    for(ll i=1;i<=n;i++){
        (ans*=i)%=mod;
    }
    if(cnt){
        ans=0;
    }
    cout<<ans<<endl;
    return 0;
}
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}
const int N=2e5+2,M=1e9+7;

int32_t main(){

    int n;
    string s;
    cin>>n>>s;
    int ans=1,fac=1,bal=0;
    for(int i=1;i<=n;++i)(fac*=i)%=M;
    for(char c:s){
        if(c=='B'){
            if(bal&1){
                (ans*=bal)%=M;
                bal--;
            }else{
                bal++;
            }
        }else{
            if(bal&1){
                bal++;
            }else{
                (ans*=bal)%=M;
                bal--;
            }
        }
    }
    if(bal!=0)ans=0;
    cout<<(ans*fac)%M<<'\n';


    return 0;
}
