#include <bits/stdc++.h>

const int maxn = 2e5 + 5;
const long long p = 1e9 + 7;
int n;
int arr[maxn], val[maxn];
long long ans = 1;

int main(){
	scanf("%d\n",&n);
	for(int i=1;i<=2*n;i++){
		char a;
		scanf("%c",&a);
		if(a == 'B') arr[i] = 1;
		else arr[i] = 0;
	}
	int stat = 0;
	for(int i=1;i<=2*n;i++){
		arr[i] ^= stat;
		if(arr[i]) val[i] = 1, stat ^= 1;
		else val[i] = 0, stat ^= 1;
	}
	long long cur = 0;
	for(int i=1;i<=2*n && ans > 0;i++){
		if(val[i] == 0 && cur == 0) ans = 0;
		else if(val[i]) cur ++;
		else ans = (ans * cur) % p, cur --;
	}
	if(cur != 0) ans = 0;
	for(int i=1;i<=n;i++) ans = (ans * i) % p;
	printf("%lld",ans);
	return 0;
} 