#include <bits/stdc++.h>
using namespace std;

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

constexpr int inf = 1.01e9;
constexpr i64 inf64 = 4.01e18;
constexpr double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <typename A, typename T, size_t size>
void fill(A (&ary)[size], const T &val) {
    fill((T *)ary, (T *)(ary + size), val);
}

template <i64 p>
class Fp {
public:
    i64 x;
    Fp() : x(0) {}
    Fp(i64 x_) : x((x_ % p + p) % p) {}
    Fp operator+() const { return Fp(x); }
    Fp operator-() const { return Fp(-x); }
    Fp& operator+=(const Fp& y) {
        x += y.x;
        if (x >= p) x -= p;
        return *this;
    }
    Fp& operator-=(const Fp& y) { return *this += -y; }
    Fp& operator*=(const Fp& y) {
        x = x * y.x % p;
        return *this;
    }
    Fp& operator/=(const Fp& y) { return *this *= Fp(inverse(y.x)); }
    Fp operator+(const Fp& y) const { return Fp(x) += y; }
    Fp operator-(const Fp& y) const { return Fp(x) -= y; }
    Fp operator*(const Fp& y) const { return Fp(x) *= y; }
    Fp operator/(const Fp& y) const { return Fp(x) /= y; }
    bool operator==(const Fp& y) const { return x == y.x; }
    bool operator!=(const Fp& y) const { return !(*this == y); }
    i64 extgcd(i64 a, i64 b, i64& x, i64& y) {
        i64 d = a;
        if (b != 0) {
            d = extgcd(b, a % b, y, x);
            y -= (a / b) * x;
        } else {
            x = 1;
            y = 0;
        }
        return d;
    }
    i64 inverse(i64 a) {
        i64 x, y;
        extgcd(a, p, x, y);
        return (x % p + p) % p;
    }
};

void solve() {
    constexpr i64 mod = 1'000'000'007;
    i64 n;
    cin >> n;
    vector<char> c(n);
    rep(i,0,n) cin >> c[i];

    vector<vector<Fp<mod>>> dp(n,vector<Fp<mod>>(n+1));
    if(c[0]=='U') dp[0][1]=1;
    else if(c[0]=='-') dp[0][0]=1;
    rep(i,0,n-1){
        rep(j,0,n+1){
            switch(c[i+1]){
                case 'D': // 右側は上とつなぐ
                    // 左側は保留
                    // 右側は上とつなぐ
                    {
                        dp[i+1][j]+=dp[i][j]*j;
                    }
                    // 両方とも上とつなぐ
                    if(j-1>=0){
                        dp[i+1][j-1]+=dp[i][j]*j*j;
                    }
                    break;
                case 'U': // 右側は保留
                    // 左側は上とつなぐ
                    // 右側は保留
                    {
                        dp[i+1][j]+=dp[i][j]*j;
                    }
                    // 両方とも保留
                    if(j+1<=n){
                        dp[i+1][j+1]+=dp[i][j];
                    }
                    break;

                case '-': // まっすぐつなぐ
                    {
                        dp[i+1][j]+=dp[i][j];
                    }
                    break;
            }
        }
    }

    cout << dp[n-1][0].x << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}



Measured memory_bytes: 3308