mod=998244353 def inv(a): rem,ans=mod-2,1 while rem: if rem%2: ans=(ans*a)%mod a=(a*a)%mod rem//=2 return ans N=int(input()) S=input() C=sum([i in ['A','B'] for i in S]) ans=[1,1] for i in range(1,C+1): ans[0]=(ans[0]*i)%mod ans[1]=(ans[1]*(i+len(S)-C))%mod print((inv(ans[0])*ans[1])%mod)