#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
ll MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    char c[n+1];
    srep(i,1,n+1) cin >> c[i];

    ll dp[n+1][n+1];
    rep(i,n+1)rep(j,n+1)dp[i][j] = 0;
    dp[0][0] = 1;
    srep(i,1,n+1){
        if(c[i] == '-'){
            rep(j,n+1) dp[i][j] = dp[i-1][j];
        }else if(c[i] == 'U'){
            srep(j,1,n+1){
                dp[i][j] += dp[i-1][j-1];
            }
            rep(j,n+1){
                dp[i][j] += dp[i-1][j] * j;
            }
            rep(j,n+1) dp[i][j] %= MOD;
        }else if(c[i] == 'D'){
            rep(j,n){
                dp[i][j] += dp[i-1][j+1] * (j+1) * (j+1);
            }
            rep(j,n+1){
                dp[i][j] += dp[i-1][j] * j;
            }
            rep(j,n+1) dp[i][j] %= MOD;
        }
        // rep(j,n+1) cout << dp[i][j] << ' ';
    }


    cout << dp[n][0] << endl;
    return 0;
}
 
 

