import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { static char[] status; static int[][] dp; static final int MOD = 998244353; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); status = sc.next().toCharArray(); dp = new int[n][2]; for (int[] arr : dp) { Arrays.fill(arr, -1); } System.out.println(dfw(n - 1, 0)); } static int dfw(int idx, int v) { if (idx < 0) { return 1; } if (dp[idx][v] < 0) { if (v == 0) { if (status[idx] == '.') { dp[idx][v] = (dfw(idx - 1, 1) + dfw(idx - 1, 0) * 2 % MOD) % MOD; } else if (status[idx] == 'L') { dp[idx][v] = dfw(idx - 1, 1); } else { dp[idx][v] = dfw(idx - 1, 0); } } else { if (status[idx] == '.') { dp[idx][v] = (dfw(idx - 1, 1) + dfw(idx - 1, 0)) % MOD; } else if (status[idx] == 'L') { dp[idx][v] = dfw(idx - 1, 1); } else if (status[idx] == 'R') { dp[idx][v] = 0; } else { dp[idx][v] = dfw(idx - 1, 0); } } } return dp[idx][v]; } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }