#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<time.h>
#include<sstream>
#define MINN -1e8 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INF=0x3f3f3f3f3f3f;
const int P=1e9+7;
const int MAXN=32000;
const double pi=3.1415926;
const ll mod=1000000007;
int n;
ll ans=1;
char c[200005];
ll f(ll len)
{
	ll cur=1;
	for(ll i=1;i<=len;i++)
	{
		cur=cur*i%mod;
	}
	return cur; 
}
int main()
{
	cin>>n;getchar();
	ll tmp=1,len=1;
	for(int i=0;i<2*n;i++)c[i]=getchar();
	if(c[0]!='B'||c[n*2-1]!='B')
	{
		cout<<0;return 0;
	}
	for(int i=1;i<2*n-1;i++)
	{
		if(c[i]=='B')  
		{
			if(tmp%2==1)
			{
				ans=ans*tmp%mod;
				tmp--;len++;
			}
			else tmp++;
		}
		else 
		{
			if(tmp%2==1) tmp++;
			else
			{
				ans=ans*tmp%mod;
				tmp--;len++;
			}
		}
	}
	if(tmp!=1)
	{
		cout<<0;return 0;
	}
	else
	{
		ans=ans*f(len)%mod;
		cout<<ans;
	}
	return 0;
}
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

long long int MOD = 1e9 + 7;

int main(){

  // read problem
  long long int N;
  std::string Stmp;
  scanf("%lld", &N);
  std::cin >> Stmp;
  std::string S = "W" + Stmp;

  std::cerr << "S: " << std::endl << S << std::endl;

  // solve problem
  long long int tmp_left = 0;
  long long int tmp_state = 0; // left
  long long int ans = 1;
  long long int possible = 1;

  for(long long int i = 1; i <= 2*N; i++){
    std::cerr << i << " " << tmp_left << " " << tmp_state << std::endl;
    if(S[i] != S[i-1]){
      // keep tmp_state
      if(tmp_state == 0){ // left
        tmp_left++;
      }
      else{// right
        ans *= tmp_left;
        ans = (ans+MOD)%MOD;
        tmp_left--;
      }
    }
    else{
      // change tmp_state
      if(tmp_state == 0){
        tmp_state = 1; // right
        ans *= tmp_left;
        ans = (ans+MOD)%MOD;
        tmp_left--;
      }
      else{
        tmp_state = 0; // left
        tmp_left++;
      }
    }
    // check answer
    if(tmp_left < 0){
      ans = 0;
      break;
    }
  }

  // left has not been used up
  if(tmp_left != 0){
    ans = 0;
  }

  // order of choosing pairs
  for(long long int i = 1; i <= N; i++){
    ans *= i;
    ans = (ans+MOD)%MOD;
  }

  std::cerr << "Answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
}