#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }
#include <cstdint>
#include <iostream>
#include <string>

template <std::uint_fast64_t Modulus = 1000000007ULL> class Modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr Modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr Modint operator+(const Modint rhs) const noexcept { return Modint(*this) += rhs; }
  constexpr Modint operator-(const Modint rhs) const noexcept { return Modint(*this) -= rhs; }
  constexpr Modint operator*(const Modint rhs) const noexcept { return Modint(*this) *= rhs; }
  constexpr Modint operator/(const Modint rhs) const noexcept { return Modint(*this) /= rhs; }
  constexpr Modint &operator+=(const Modint rhs) noexcept {
    a += rhs.a; if (a >= Modulus) a -= Modulus;
    return *this;
  }
  constexpr Modint &operator-=(const Modint rhs) noexcept {
    if (a < rhs.a) { a += Modulus; } a -= rhs.a;
    return *this;
  }
  constexpr Modint &operator*=(const Modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr Modint &operator/=(Modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) *this *= rhs;
      rhs *= rhs; exp /= 2;
    }
    return *this;
  }
  Modint pow(u64 exp) {
    Modint<> ret = 1, x = this->a;
    while(exp > 0) {
        if (exp & 1) ret *= x;
        x *= x; exp >>= 1;
    }
    return ret;
  }
};

template <std::uint_fast64_t Modulus> std::ostream& operator<<(std::ostream& os, const Modint<Modulus>& obj) { os << obj.value(); return os; }
template <std::uint_fast64_t Modulus> std::istream& operator>>(std::istream& is, Modint<Modulus>& obj) { std::uint_fast64_t a; is >> a; obj = Modint<Modulus>(a); return is; }

using namespace std;

int n;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> s;

    if (s[0] != 'B' || s[s.size() - 1] != 'B') {
        cout << 0 << endl;
        return 0;
    }
    int coming = 0;
    Modint<> ans = 1;
    REP(i, 2 * n) {
        bool left;
        if (coming % 2 == 0) {
            // 偶数個の区間が左からきてる
            // Bなら必ずleft, Wなら必ずright
            left = s[i] == 'B';
        } else {
            // その逆
            left = s[i] == 'W';
        }
        // DDD(s[i], coming, left);
        if (left) {
            coming++;
        } else {
            ans *= coming;
            coming--;
        }
    }
    if (coming != 0) {
        cout << 0 << endl;
        return 0;
    }
    // D(coming);
    for (int i = 1; i <= n; ++i) ans *= i;
    cout << ans << endl;
}


Measured memory_bytes: 832