//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll pow(ll x, ll ntimes) {
    ll ret = 1;
    while (ntimes > 0) {
        if ((ntimes & 1) == 1) {
            ret = ret * x;
        }
        x = x * x;
        ntimes >>= 1;
    }
    return ret;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 1;
    vector<bool> prime(n+1,true);
    for(ll i=2;i<=n;++i){
        if(prime[i]==true){
            ll cnt = 0;
            for(ll j=2*i;j<=n;j+=i){
                prime[j]=false;
            }
            ll t = 1;
            while(pow(i,t)<=n){
                ll x = pow(i,t);
                cnt += (n/x);
                t++;
            }
            ans *= (cnt+1);
            ans %= mod;
        }
    }
    cout << ans << endl;

    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define int long long
#define mod 1000000007
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 200005
int a[N];
char s[N];
int n;
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	n=read();
	scanf("%s",s+1);
	for(int i=1;i<=n*2;i++)
	{
		a[i]=(s[i]=='B');
	}
	int cur=0,ans=1;
	for(int i=1;i<=n*2;i++)
	{
		if((cur&1)==a[i])
		{
			ans=ans*cur%mod;
			cur--;
		}
		else cur++;
	}
	if(cur!=0) return cout<<"0\n",0;
	for(int i=1;i<=n;i++)
	{
		ans=ans*i%mod;
	}
	cout<<ans<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}

