#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<18,INF=1<<30;

int main(){

    int N;cin>>N;
    vector<char> S(N);
    for(int i=0;i<N;i++) cin>>S[i];
    
    ll dp[N+1][N+1];
    memset(dp,0,sizeof(dp));
    
    dp[0][0]=1;
    
    for(int i=0;i<N;i++){
        for(int j=0;j<=i;j++){
            if(S[i]=='-'){
                dp[i+1][j+1]+=dp[i][j];
                dp[i+1][j+1]%=mod;
            }else if(S[i]=='U'){
                dp[i+1][j+1]+=dp[i][j]*(i-j);
                dp[i+1][j]+=dp[i][j];
                
                dp[i+1][j+1]%=mod;
                dp[i+1][j]%=mod;
            }else if(S[i]=='D'){
                dp[i+1][j+2]+=dp[i][j]*(i-j)*(i-j);
                dp[i+1][j+1]+=dp[i][j]*(i-j);
                
                dp[i+1][j+2]%=mod;
                dp[i+1][j+1]%=mod;
            }
        }
    }
    
    cout<<dp[N][N]<<endl;
}

