N = int(input()) S = list(input()) mod =998244353 countab = 0 countcd = 0 for s in S: if s=="A" or s=="B": countab+=1 else: countcd+=1 fac = [1]*(N+1) rfac = [1]*(N+1) for i in range(1,N+1): fac[i] = fac[i-1]*i%mod rfac[i] = pow(fac[i], mod-2, mod) def comb(n, r, mod): return (fac[n]*rfac[r]*rfac[n-r])%mod print(comb(N,countab,mod))