N = gets.chomp.to_i
M = 2*N
S = gets.chomp
mod = 10**9 + 7

answer = 1
x = 0
y = 0
i = 0
while i < M
    if i%2 == 0
        if S[i] == "B"
            y += 1
        else
            answer *= (y-x)
            answer %= mod
            x += 1
        end
    else
        if S[i] == "W"
            y += 1
        else
            answer *= (y-x)
            answer %= mod
            x += 1
        end
    end
    i += 1
end

if x == y
    i = 1
    while i <= N
        answer *= i
        answer %= mod
        i += 1
    end
    puts answer
else
    puts 0
end