let n = stdin.ReadLine() |> int
let s = stdin.ReadLine()
let front = [for i in 0..(n-1) do yield s.[i]]
let back = [for i in 0..(n-1) do yield s.[2 * n - 1 - i]]
let modulo = 1000000007L

let rec f ls acc baisu =
 match ls with
 | [] -> (acc,baisu)
 | hd :: tl -> match hd with
               | 'B' -> if (acc % 2 = 0 && acc >= 0) then f tl (acc + 1) baisu
                        elif (acc % 2 = 1 && acc >= 0) then f tl (acc - 1) (acc :: baisu)
                        else f [] -1 [0]
               | _ -> if (acc % 2 = 1 && acc >= 0) then f tl (acc + 1) baisu
                      elif (acc % 2 = 0 && acc >= 0) then f tl (acc - 1) (acc :: baisu)
                      else f [] -1 [0]

let (front_acc,front_baisu) = f front 0 []
let (back_acc,back_baisu) = f back 0 []

let g(x)= x % modulo

let kaijo y =
 let y_64 = int64 y
 let rec kaijo_pre x accc = (if x <= 1L then accc else kaijo_pre (x - 1L) (g(g(x) * accc)))
 kaijo_pre y_64 1L

let tyukan = if (front_acc >= 0 && front_acc = back_acc) then kaijo front_acc else 0L

let seki ls =
 let rec seki_pre ls acccc =
  match ls with
  | [] -> acccc
  | hd :: tl -> seki_pre tl (g(g(int64 hd) * acccc))
 seki_pre ls 1L

let front_seki = seki front_baisu
let back_seki = seki back_baisu

g(g(g(front_seki * back_seki) * tyukan) * (kaijo n))
|>stdout.WriteLine