#include <bits/stdc++.h>
#include <iomanip>
//#define DEBUG 1

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;

#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(int)(b);--i)
#define RREP(i,n) RFOR(i,n,0)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define UNQ(a) a.erase(std::unique(ALL(a)),a.end());
#define endl "\n"

#define BEGIN_STACK(size) \
	void *dummy = malloc(size); \
	void *org_stack; \
	char *my = (char *)alloca((1 + (int)(((long long)dummy) & 127)) * 16); \
	*my = 0; \
	asm volatile("mov %%rsp, %%rbx\n" \
		"mov %%rax, %%rsp" \
		: "=b"(org_stack) \
		: "a"((char *)dummy + (size)-1024));

#define END_STACK \
	asm volatile("mov %%rax, %%rsp" ::"a"(org_stack)); \
	free(dummy);

const LD EPS=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9+7;

template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}

const LL powLL(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

template<typename... Args>
void printd(const Args&... args)
{
	#ifdef DEBUG
		print(args...);
	#endif
}

template<typename Head>
void input(Head& head)
{
	cin>>head;
}

template<typename Head, typename... Tail>
void input(Head& head, Tail&... tail)
{
	cin>>head;
	input(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
istream& operator >> (istream& is, pair<T, U>& t)
{
	is>>t.first>>t.second;
	return is;
}

template<int N, typename... Ts, typename enable_if<N == sizeof...(Ts)-1>::type*& = enabler>
void tuple_in(istream &is, tuple<Ts...> &t)
{
	is>>get<N>(t);
}
template<int N, typename... Ts, typename enable_if<N < sizeof...(Ts)-1>::type*& = enabler>
void tuple_in(istream &is, tuple<Ts...> &t)
{
	is>>get<N>(t);
	tuple_in<N+1, Ts...>(is, t);
}

template<typename... Ts>
istream& operator >> (istream& is, tuple<Ts...>& t)
{
	tuple_in<0, Ts...>(is, t);
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& t)
{
	os<<'('<<t.first<<", "<<t.second<<')';
	return os;
}

template<int N, typename... Ts, typename enable_if<N == sizeof...(Ts)-1>::type*& = enabler>
void tuple_out(ostream &os,const tuple<Ts...> &t)
{
	os<<get<N>(t);
}
template<int N, typename... Ts, typename enable_if<N < sizeof...(Ts)-1>::type*& = enabler>
void tuple_out(ostream &os,const tuple<Ts...> &t)
{
	os<<get<N>(t)<<", ";
	tuple_out<N+1, Ts...>(os, t);
}

template<typename... Ts>
ostream& operator << (ostream& os, const tuple<Ts...>& t)
{
	os<<'(';
	tuple_out<0, Ts...>(os, t);
	os<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}



using mod_type = long long;
template<mod_type MODULO=1000000007>
class Mod
{
	public:
		using value_type = mod_type;

	private:
		value_type value;
		constexpr value_type Normalize(value_type x) const
		{
			return x<0?(x%MODULO+MODULO):(x%MODULO);
		}

	public:
		constexpr Mod<MODULO>():value(0){}
		constexpr Mod<MODULO>(const value_type &val):value(Normalize(val)) {}
		
		explicit operator value_type () const
		{
			return value;
		}

		constexpr const Mod<MODULO> operator -() const
		{
			return Mod<MODULO>(MODULO - value);
		}
		constexpr const Mod<MODULO> operator +(const Mod<MODULO> &rhs) const
		{
			return Mod<MODULO>(value + rhs.value);
		}
		constexpr const Mod<MODULO> operator -(const Mod<MODULO> &rhs) const
		{
			return Mod<MODULO>(value + (-rhs).value);
		}
		constexpr const Mod<MODULO> operator *(const Mod<MODULO> &rhs) const
		{
			return Mod<MODULO>(value * rhs.value);
		}
		Mod<MODULO> &operator +=(const Mod<MODULO> &rhs)
		{
			return *this = *this + rhs;
		}
		Mod<MODULO> &operator -=(const Mod<MODULO> &rhs)
		{
			return *this = *this - rhs;
		}
		Mod<MODULO> &operator *=(const Mod<MODULO> &rhs)
		{
			return *this = *this * rhs;
		}


		Mod<MODULO> pow(value_type p) const;

		Mod<MODULO> inv() const
		{
			return pow(MODULO-2);
		}

		const Mod<MODULO> operator /(const Mod<MODULO> &rhs) const
		{
			return *this * rhs.inv();
		}
		Mod<MODULO> &operator /=(const Mod<MODULO> &rhs)
		{
			return *this = *this / rhs;
		}

		constexpr const bool operator <(const Mod<MODULO> &rhs) const
		{
			return value < rhs.value;
		}
		constexpr const bool operator ==(const Mod<MODULO> &rhs) const
		{
			return value == rhs.value;
		}
};

template<mod_type MODULO>
Mod<MODULO> Mod<MODULO>::pow(value_type p) const
{
	Mod<MODULO> tmp=1, mult=*this;
	while(p)
	{
		if((p&1)>0) tmp*=mult;
		p>>=1;
		mult*=mult;
	}
	return tmp;
}

namespace std
{
	template<mod_type MODULO>
	ostream& operator<<(ostream& os, const Mod<MODULO> mod)
	{
		os<<(typename Mod<MODULO>::value_type)mod;
		return os;
	}
};

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	Mod<> dp=1;
	Mod<> cnt=0;
	REP(i,n*2)
	{
		if((i%2==0) ^ (s[i]=='B')) //kudari
		{
			dp*=cnt;
			cnt-=1;
		}
		else //nobori
		{
			cnt+=1;
		}
	}
	if(!(cnt==0)) dp=0;
	Mod<> fct=1;
	REP(i,n)
		fct*=(i+1);
	dp*=fct;
	print(dp);
}

Measured memory_bytes: 640