#include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);

  int N; cin>>N;
  string S; cin>>S;

  if (S[0] != 'B' or S.back() != 'B') {
    cout << 0 << endl;
    return 0;
  }

  long cl = 0;
  long cr = 0;
  const long MOD = 1e9+7;
  long pat = 1;
  bool d = false;
  for (int i = 0; i < S.size(); i++) {
    if (i > 0) {
      if (S[i] == S[i-1])
        d = !d;
    }
    if (d == true) {
      pat *= cl - cr;
      pat %= MOD;
    }
    if (d == false) {
      cl++;
    } else {
      cr++;
    }
  }
  if (cl != cr) {
    cout << 0 << endl;
    return 0;
  }

  for (long i = 1; i <= N; i++) {
    pat = pat * i % MOD;
  }

  cout << pat << endl;

  return 0;
}
