import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] s = sc.next().toCharArray(); sc.close(); int mod = 998244353; long[] dpl = new long[n]; long[] dpr = new long[n]; long[] dpu = new long[n]; if (s[0] == 'L' || s[0] == '.') dpl[0] = 1; if (s[0] == 'R' || s[0] == '.') dpr[0] = 1; if (s[0] == 'U' || s[0] == '.') dpu[0] = 1; for (int i = 1; i < n; i++) { if (s[i] == 'L' || s[i] == '.') { dpl[i] = (dpl[i - 1] + dpu[i - 1]) % mod; } if (s[i] == 'R' || s[i] == '.') { dpr[i] = (dpl[i - 1] + dpr[i - 1] + dpu[i - 1]) % mod; } if (s[i] == 'U' || s[i] == '.') { dpu[i] = (dpl[i - 1] + dpr[i - 1] + dpu[i - 1]) % mod; } } long ans = dpl[n - 1] + dpr[n - 1] + dpu[n - 1]; ans %= mod; System.out.println(ans); } }