MOD = 998244353 n = int(input()) S = input() a = 0 for s in S: if s == "A" or s == "B": a += 1 ans = 1 for i in range(n, n - a, -1): ans *= i ans %= MOD inv = 1 for i in range(1, a + 1): inv *= i inv %= MOD ans *= pow(inv, MOD - 2, MOD) print(ans % MOD)