#include using namespace std; #define rep(i, s, t) for (auto i{s}; std::cmp_less(i, t); ++i) #include typedef atcoder::modint998244353 Int; ostream& operator<<(ostream &o, Int const &x) { return o << x.val(); } struct DP { Int L, U, R; }; int main() { int N; string S; cin >> N >> S; vector dp(N); rep(i, 0, N) { if (i == 0) { dp[i].L = dp[i].U = dp[i].R = Int::raw(1); } else { dp[i].L = dp[i-1].L + dp[i-1].U; dp[i].U = dp[i-1].L + dp[i-1].U + dp[i-1].R; dp[i].R = dp[i-1].L + dp[i-1].U + dp[i-1].R; } if (S[i] == 'L') dp[i].U = dp[i].R = Int::raw(0); if (S[i] == 'U') dp[i].L = dp[i].R = Int::raw(0); if (S[i] == 'R') dp[i].L = dp[i].U = Int::raw(0); } cout << dp[N-1].L + dp[N-1].U + dp[N-1].R << endl; }