#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

char s[400];
ll dp[300][300];

int main(){
	int n;cin>>n;
	rep(i,n)cin>>s[i];
	dp[0][0]=1;
	rep(i,n)rep(j,i+1){
		if(dp[i][j]==0)continue;
		if(s[i]=='U'){
			(dp[i+1][j+1]+=dp[i][j])%=MOD;
			if(j)(dp[i+1][j]+=dp[i][j]*j)%=MOD;
		}
		if(s[i]=='D'){
			if(j){
				(dp[i+1][j-1]+=dp[i][j]*j*j)%=MOD;
				(dp[i+1][j]+=dp[i][j]*j)%=MOD;
			}
		}
		if(s[i]=='-'){
			(dp[i+1][j]+=dp[i][j])%=MOD;
		}
	}
	cout<<dp[n][0]<<endl;
}
