from collections import Counter n = int(input()) S = list(input()) mod = 998244353 fact = [1] * (n + 1) inv = [1] * (n + 1) finv = [1] * (n + 1) for i in range(2, n + 1): fact[i] = fact[i - 1] * i % mod inv[i] = mod - inv[mod % i] * (mod // i) % mod finv[i] = finv[i - 1] * inv[i] % mod def comb(x, y): return (fact[x] * finv[y] % mod) * finv[x - y] % mod counter = Counter(S) print(comb(n, counter['A'] + counter['B']))