#include #include using namespace std; using namespace atcoder; using ll = long long; using mint=modint998244353; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); map mp; mp['R'] = 0; mp['L'] = 1; mp['U'] = 2; mp['.'] = 3; int N, c; string S; cin >> N >> S; vector dp(N+1, vector(3)); if (S[0] != '.') dp[1][mp[S[0]]] += 1; else{ for (int i=0; i<3; i++) dp[1][i] += 1; } for (int i=2; i<=N; i++){ c = mp[S[i-1]]; for (int j=0; j<3; j++){ for (int k=0; k<3; k++){ if (c != 3 && k != c) continue; if (j == 0 && k == 1) continue; dp[i][k] += dp[i-1][j]; } } } cout << (dp[N][0]+dp[N][1]+dp[N][2]).val() << endl; return 0; }