import java.util.Scanner; class Main{ private static final int MOD = 998244353; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] dp = new int[N]; dp[2] = 1; String S = sc.next(); for(char c:S.toCharArray()){ if(c=='L'){ dp[0] += dp[2]; if(dp[0]>=MOD) dp[0] -= MOD; dp[1] = dp[2] = 0; } if(c=='R'){ dp[1] += dp[0]; if(dp[1]>=MOD) dp[1] -= MOD; dp[1] += dp[2]; if(dp[1]>=MOD) dp[1] -= MOD; dp[0] = dp[2] = 0; } if(c=='U'){ dp[2] += dp[0]; if(dp[2]>=MOD) dp[2] -= MOD; dp[2] += dp[1]; if(dp[2]>=MOD) dp[2] -= MOD; dp[0] = dp[1] = 0; } if(c=='.'){ int[] next = new int[3]; next[0] = dp[0]+dp[2]; if(next[0]>=MOD) next[0] -= MOD; next[1] = dp[0]+dp[1]; if(next[1]>=MOD) next[1] -= MOD; next[1] += dp[2]; if(next[1]>=MOD) next[1] -= MOD; next[2] = dp[0]+dp[1]; if(next[2]>=MOD) next[2] -= MOD; next[2] += dp[2]; if(next[2]>=MOD) next[2] -= MOD; dp = next; } } System.out.println(((dp[0]+dp[1])%MOD+dp[2])%MOD); } }