import sys input = lambda: sys.stdin.readline().rstrip() mod = 998244353 class Mod_Comb: def __init__(self, limit: int, mod: int): "O(limit)" # limit: limit C r. # if n is too large: limit = -1 and use ncr_2. # mod: prime. self.limit = limit self.mod = mod self.fact = [1, 1] self.factinv = [1, 1] self.inv = [0, 1] for i in range(2, self.limit+1): self.fact.append((self.fact[-1]*i % self.mod)) self.inv.append((-self.inv[self.mod%i] * (self.mod // i)) % self.mod) self.factinv.append((self.factinv[-1] * self.inv[-1]) % self.mod) def div_mod(self, a: int, b: int) -> int: "Return (a // b % mod), mod:prime" if (a % b == 0): return a // b return (a % self.mod) * pow(b, self.mod-2, self.mod) % self.mod def ncr(self, n: int, r: int) -> int: "Return (nCr % mod)" "O(1), N <= 10**7" if r < 0 or n < r: return 0 r = min(r, n-r) return self.fact[n] * self.factinv[r] * self.factinv[n-r] % self.mod def ncr_2(self, n: int, r: int) -> int: "O(r)" ret = 1 r = min(r, n-r) for i in range(r): ret *= n - i ret %= self.mod for i in range(1, r+1): ret = self.div_mod(ret, i) return ret # ----------------------- # n = int(input()) s = input() cnt = s.count('A') + s.count('B') mc = Mod_Comb(n, mod) ans = mc.ncr(n, cnt) print(ans)