def main(): N = int(input()) S = input() MOD = 998244353 dp_table = [[0, 0] for _ in range(N+1)] # 0: R 1: R以外 dp_table[0][1] = 1 for idx, letter in enumerate(S): match letter: case "L": dp_table[idx+1][1] = dp_table[idx][1] case "R": dp_table[idx+1][0] = dp_table[idx][0] + dp_table[idx][1] case "U": dp_table[idx+1][1] = dp_table[idx][0] + dp_table[idx][1] case ".": dp_table[idx+1][0] = dp_table[idx][0] + dp_table[idx][1] dp_table[idx+1][1] = dp_table[idx][0] + dp_table[idx][1] * 2 case _: raise ValueError dp_table[idx+1][1] %= MOD dp_table[idx+1][0] %= MOD print((dp_table[-1][0] + dp_table[-1][1]) % MOD) if __name__ == "__main__": main()