use std::fmt::Display;
use std::io::{stdin, Read};
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use std::str::FromStr;
pub const MOD: usize = 1000_000_007;

#[derive(Clone, Copy, PartialEq, Debug, Default)]
pub struct Mint<T>(pub T);

impl Mint<usize> {
    pub fn pow(self, exp: usize) -> Self {
        let mut exp = exp;
        let mut v = self;
        let mut ret = Mint(1);
        while exp > 0 {
            if exp & 1 == 1 {
                ret *= v;
            }
            v *= v;
            exp >>= 1;
        }
        ret
    }
    pub fn inv(self) -> Self {
        self.pow(MOD - 2)
    }
}

impl<T: Display + Copy + PartialEq> Display for Mint<T> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl<T: FromStr + Copy + PartialEq> FromStr for Mint<T> {
    type Err = T::Err;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let v = T::from_str(s)?;
        Ok(Mint(v))
    }
}

impl Add<usize> for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: usize) -> Self::Output {
        Mint((self.0 + rhs) % MOD)
    }
}

impl Add for Mint<usize> {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        self + rhs.0
    }
}

impl AddAssign<usize> for Mint<usize> {
    fn add_assign(&mut self, rhs: usize) {
        *self = *self + rhs;
    }
}

impl AddAssign for Mint<usize> {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub<usize> for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: usize) -> Self::Output {
        let rhs = rhs % MOD;
        let lhs = self.0 + if self.0 < rhs { MOD } else { 0 };
        Mint(lhs - rhs)
    }
}

impl Sub for Mint<usize> {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        self - rhs.0
    }
}

impl SubAssign<usize> for Mint<usize> {
    fn sub_assign(&mut self, rhs: usize) {
        *self = *self - rhs
    }
}

impl SubAssign for Mint<usize> {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs
    }
}

impl Mul<usize> for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: usize) -> Self::Output {
        Mint((self.0 * rhs) % MOD)
    }
}

impl Mul for Mint<usize> {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        self * rhs.0
    }
}

impl MulAssign<usize> for Mint<usize> {
    fn mul_assign(&mut self, rhs: usize) {
        *self = *self * rhs;
    }
}

impl MulAssign for Mint<usize> {
    fn mul_assign(&mut self, rhs: Self) {
        *self = *self * rhs;
    }
}

impl Div<usize> for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: usize) -> Self::Output {
        self * Mint(rhs).pow(MOD - 2)
    }
}

impl Div for Mint<usize> {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        self / rhs.0
    }
}

impl DivAssign<usize> for Mint<usize> {
    fn div_assign(&mut self, rhs: usize) {
        *self = *self / rhs;
    }
}
impl DivAssign for Mint<usize> {
    fn div_assign(&mut self, rhs: Self) {
        *self = *self / rhs;
    }
}

pub fn get_factorials(n: usize) -> Vec<Mint<usize>> {
    let mut facts = vec![Mint(0); n];
    facts[0] = Mint(1);
    for i in 1..n {
        facts[i] = facts[i - 1] * (i as usize);
    }
    facts
}

pub fn get_facinvs(n: usize, facts: &Vec<Mint<usize>>) -> Vec<Mint<usize>> {
    let mut invs = vec![Mint(0); n];
    invs[n - 1] = facts[n - 1].inv();
    for i in (0..(n - 1)).rev() {
        invs[i] = invs[i + 1] * (i + 1)
    }
    invs
}

pub fn gcd(a: usize, b: usize) -> usize {
    match b {
        0 => a,
        _ => gcd(b, a % b),
    }
}

pub fn prime_factors(x: usize) -> Vec<usize> {
    let mut res = vec![];
    let mut y = x;
    let mut p = 2;
    let upper = (y as f64).sqrt() as usize;
    while y > 1 && p <= upper {
        match y % p {
            0 => {
                res.push(p);
                y /= p;
            }
            _ => {
                p += 1;
            }
        }
    }
    if y > 1 {
        res.push(y)
    }
    return res;
}

pub struct CombMod {
    facts: Vec<Mint<usize>>,
    invs: Vec<Mint<usize>>,
}

impl CombMod {
    pub fn new(n: usize) -> Self {
        let facts = get_factorials(n);
        let invs = get_facinvs(n, &facts);
        CombMod {
            facts: facts,
            invs: invs,
        }
    }
    pub fn get(&self, a: usize, b: usize) -> Mint<usize> {
        if a < b {
            Mint(0)
        } else {
            (self.facts[a as usize] * self.invs[b as usize]) * self.invs[(a - b) as usize]
        }
    }
}
macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn solve(s: &str) -> usize {
    let mut it = s.split_whitespace();
    let n: usize = parse!(it);
    let lr = it
        .next()
        .unwrap()
        .chars()
        .enumerate()
        .map(|(i, c)| (i % 2 == 1) ^ (c == 'W'));
    let mut lcount = Mint(0);
    let mut ret = Mint(1);
    let facts = get_factorials(1000000);

    for r in lr {
        if r {
            ret *= lcount;
            lcount -= 1;
        } else {
            lcount += 1;
        }
    }
    if lcount.0 != 0 {
        ret = Mint(0);
    }
    ret *= facts[n];
    ret.0
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    println!("{}", solve(&s));
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        1
        BB
        ";
        assert_eq!(solve(s), 1);
    }
    #[test]
    fn test_input1() {
        let s = "
        1
        BW
        ";
        assert_eq!(solve(s), 0);
    }
}


Measured memory_bytes: 12540