#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; #include using mint = atcoder::modint998244353; int main() { int n; string s; cin >> n >> s; vector dp(n, vector(3)); rep(i, n) { char c = s[i]; if (c == 'L' || c == '.') { if (i == 0) { dp[i][0] = 1; } else { dp[i][0] = dp[i - 1][0] + dp[i - 1][2]; } } if (c == 'R' || c == '.') { if (i == 0) { dp[i][1] = 1; } else { dp[i][1] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2]; } } if (c == 'U' || c == '.') { if (i == 0) { dp[i][2] = 1; } else { dp[i][2] = dp[i - 1][0] + dp[i - 1][1] + dp[i - 1][2]; } } } cout << (dp[n - 1][0] + dp[n - 1][1] + dp[n - 1][2]).val() << endl; return 0; }