fun main(args: Array<String>) {
    val mod = 1000000007L
    val n = readLine()!!.toInt()
    val s = readLine()!!

    if (s.first() != 'B' || s.last() != 'B') {
        println(0)
        return
    }
    var lr = mutableListOf('L')
    (1 until 2 * n).forEach {
        when {
            (s[it - 1] == s[it] && lr[it - 1] == 'L') -> lr.add('R')
            (s[it - 1] != s[it] && lr[it - 1] == 'L') -> lr.add('L')
            (s[it - 1] == s[it] && lr[it - 1] == 'R') -> lr.add('L')
            (s[it - 1] != s[it] && lr[it - 1] == 'R') -> lr.add('R')
        }
    }
    val countL = Array(2 * n) { 1L }
    (1 until 2 * n).forEach {
        countL[it] = countL[it - 1] + if (lr[it] == 'L') 1 else 0
    }
    if (countL[2 * n - 1].toInt() != n) {
        println(0)
        return
    }

    var ans = 1L
    var used = 0L
    (1 until 2 * n).forEach {
        if (lr[it] == 'R') {
            ans *= countL[it] - used++
            ans %= mod
        }
    }
    (2..n).forEach {
        ans *= it
        ans %= mod
    }
    println(ans)
}
