defmodule Main do @spec input() :: binary() def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts (if b, do: "Yes", else: "No") def pow(x, n, mod) do cond do n == 0 -> 1 rem(n, 2) == 0 -> y = pow(x, div(n, 2), mod) rem(y * y, mod) true -> rem(x * pow(x, n - 1, mod), mod) end end @mod 998244353 def inv(x) do pow(x, @mod-2, @mod) end def comb(n, k) do for i <- 1..k//1, reduce: 1 do acc -> x = rem(acc * inv(i), @mod) rem(x * (n-i+1), @mod) end end def main do n = ii() cs = input() |> String.graphemes() ab = cs |> Enum.count(&(&1 == "A" || &1 == "B")) ans = comb(n, ab) IO.puts ans end end