#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
using std::cin; using std::cout;
using std::endl;
using std::bitset; using std::map;
using std::queue; using std::priority_queue;
using std::set; using std::string;
using std::stringstream; using std::vector;
using std::pair; using std::make_pair;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<ULL, ULL> puu;
#ifdef DEBUG
using std::cerr;
#define pass cerr << "[" << __FUNCTION__ << "] : line = " << __LINE__ << endl;
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n)                                                     \
  {                                                                            \
    cerr << #a << " = {";                                                      \
    for (int qwq = (st); qwq <= (n); ++qwq)                                    \
      if (qwq == (st))                                                         \
        cerr << a[qwq];                                                        \
      else                                                                     \
        cerr << ", " << a[qwq];                                                \
    cerr << "}" << endl;                                                       \
  }
#define displayv(a) displaya(a, 0, (int)(a.size() - 1))
#include <ctime>
class MyTimer {
    clock_t st;
public:
    MyTimer() { cerr << std::fixed << std::setprecision(0); reset(); }
    ~MyTimer() { report(); }
    void reset() { st = clock_t(); }
    void report() {  cerr << "Time consumed: " << (clock() - st) * 1e3 / CLOCKS_PER_SEC << "ms" << endl; }
} myTimer;
#else
#define cerr if(false) std::cout
#define pass ;
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(a) ;
class MyTimer {
public: void reset() {} void report() {}
} myTimer;
#endif

template<typename A, typename B>
std::ostream& operator << (std::ostream &cout, const pair<A, B> &x) {
    return cout << "(" << x.first << ", " << x.second << ")";
}
template<typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }

const int maxN = 3000 + 5;
const LL P = 1000000007;
int n, m;
LL fac[maxN], ifac[maxN];
LL qpow(LL a, LL b) {
    LL r = 1;
    while(b) {
        if(b & 1) (r *= a) %= P;
        (a *= a) %= P; b >>= 1;
    }
    return r;
}

LL choose(LL n, LL k) {
    if(k < 0 || k > n) return 0;
    return fac[n] * ifac[k] % P * ifac[n - k] % P;
}

LL f[2][2][maxN];
void inc(LL &x, const LL &y) { (x += y) >= P ? x -= P : 233; }
void dec(LL &x, const LL &y) { (x -= y) < 0 ? x += P : 233; }

/*
4
<><
5
<<<<
*/

int main() {
    cin >> n;
    static char s[maxN];
    scanf("%s", s);
    m = 0;
    for(char c : s) m += (c == '<');
    fac[0] = 1; 
    for(int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % P;
    ifac[n] = qpow(fac[n], P - 2);
    for(int i = n - 1; i >= 0; --i) ifac[i] = ifac[i + 1] * (i + 1) % P;
    int p = 0;
    memset(f, 0, sizeof(f));
    f[p][0][0] = fac[n];
    for(int i = 0; i < n - 1; ++i, p ^= 1) {
        memset(f[p ^ 1], 0, sizeof(f[p ^ 1]));
        display(i);
        displaya(f[p][0], 0, n - 1);
        displaya(f[p][1], 0, n - 1);
        for(int c = 0; c < 2; ++c)
            for(int j = 0; j < n; ++j)
                inc(f[p ^ 1][c ^ (s[i] == '>')][j + 1], f[p][c][j]);
        if(s[i] == '<') continue;
        // else apply PIE
        for(int c = 0; c < 2; ++c)
            for(int j = 0; j < n; ++j)
                inc(f[p ^ 1][c][0], f[p][c][j] * ifac[j + 1] % P);
    }
    LL ans = 0;
    for(int c = 0; c < 2; ++c)
        for(int j = 0; j < n; ++j) {
            f[p][c][j] = f[p][c][j] * ifac[j + 1] % P;
            (c == 0 ? inc : dec)(ans, f[p][c][j] % P);
        }
    displaya(f[p][0], 0, n - 1);
    displaya(f[p][1], 0, n - 1);
    // ans = ans * fac[n] % P;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384