// Author: Shusuke Ueda
// AOJ 2439 - 箱根駅伝

#include <iostream>
#include <vector>

namespace nt {
    template <int_fast64_t mod>
    class ModInt {
        int_fast64_t val;

      public:
        ModInt(): val(0) {}
        ModInt(int_fast64_t init_val): val(init_val >= 0? init_val % mod: mod - (-init_val % mod)) {}

        friend std::istream& operator >> (std::istream& is, ModInt& n) {
            int_fast64_t init_val;
            is >> init_val;
            n = ModInt(init_val);
            return is;
        }
        friend std::ostream& operator << (std::ostream& os, const ModInt n) {
            os << n.val;
            return os;
        }

        ModInt operator -() const {
            return ModInt(-val);
        }
        bool operator !() const {
            return val == 0;
        }
        ModInt& operator ++() {
            val++;
            if (val >= mod) {
                val -= mod;
            }
            return *this;
        }
        ModInt operator ++(int) {
            ModInt tmp = *this;
            val++;
            if (val >= mod) {
                val -= mod;
            }
            return tmp;
        }
        ModInt& operator --() {
            val--;
            if (val < 0) {
                val += mod;
            }
            return *this;
        }
        ModInt operator --(int) {
            ModInt tmp = *this;
            val--;
            if (val < 0) {
                val += mod;
            }
            return tmp;
        }

        ModInt& operator += (const ModInt that) {
            val += that.val;
            if (val >= mod) {
                val -= mod;
            }
            return *this;
        }
        ModInt& operator -= (const ModInt that) {
            val -= that.val;
            if (val < 0) {
                val += mod;
            }
            return *this;
        }
        ModInt& operator *= (const ModInt that) {
            val = val * that.val % mod;
            return *this;
        }
        ModInt& operator /= (const ModInt that) {
            int_fast64_t res = 1, n = that.val, p = mod - 2;
            while (p > 0) {
                if (p % 2 == 1) {
                    res = res * n % mod;
                }
                n = n * n % mod;
                p /= 2;
            }
            val = val * res % mod;
            return *this;
        }

        ModInt operator + (const ModInt that) const {
            return ModInt(*this) += that;
        }
        ModInt operator - (const ModInt that) const {
            return ModInt(*this) -= that;
        }
        ModInt operator * (const ModInt that) const {
            return ModInt(*this) *= that;
        }
        ModInt operator / (const ModInt that) const {
            return ModInt(*this) /= that;
        }
    };

    using mint = ModInt<1000000007>;
}

int main() {
    int n;
    std::cin >> n;
    std::string s;
    for (int i = 0; i < n; i++) {
        char c;
        std::cin >> c;
        if (c != '-') {
            s += c;
        }
    }
    n = s.length();
    s = '0' + s + '0';

    std::vector<std::vector<nt::mint>> dp(n + 1, std::vector<nt::mint>(n + 2));
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (s[i] == 'U') {
                if (j > 0) {
                    dp[i][j] += dp[i - 1][j - 1];
                }
                dp[i][j] += dp[i - 1][j] * j;
            } else {
                dp[i][j] += dp[i - 1][j] * j + dp[i - 1][j + 1] * (j + 1) * (j + 1);
            }
        }
    }

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


Measured memory_bytes: 3296