N = int(input()) S = input() MOD = 998244353 dp = [1,0,0] for c in S: ndp = [0,0,0] if c == 'L': ndp[0] = sum(dp[:2]) % MOD elif c == 'U': ndp[1] = sum(dp) % MOD elif c == 'R': ndp[2] = sum(dp) % MOD else: ndp[0] = sum(dp[:2]) % MOD ndp[1] = sum(dp) % MOD ndp[2] = sum(dp) % MOD dp = ndp print(sum(dp) % MOD)