N = int(input()) S = input() AB = S.count("A") + S.count("B") M = 998244353 R1, R2 = 1, 1 for i in range(AB): R1 = R1 * (N - i) % M R2 = R2 * (i + 1) % M print(R1 * pow(R2, M - 2, M) % M)