N=int(input()) S=input() mod=998244353 DP0=[0]*(N+1) DP1=[0]*(N+1) DP2=[0]*(N+1) DP0[0]=1 for i in range(N): if S[i]=="L": DP1[i+1]=DP0[i]+DP1[i] elif S[i]=="R": DP2[i+1]=DP0[i]+DP1[i]+DP2[i] elif S[i]=="U": DP0[i+1]=DP0[i]+DP1[i]+DP2[i] else: DP0[i+1]=DP0[i]+DP1[i]+DP2[i] DP1[i+1]=DP0[i]+DP1[i] DP2[i+1]=DP0[i]+DP1[i]+DP2[i] DP0[i+1]%=mod DP1[i+1]%=mod DP2[i+1]%=mod print((DP0[-1]+DP1[-1]+DP2[-1])%mod)