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

const uint64_t M = 1'000'000'007;

enum rangeOperaion{
    NUL,
    UPDATE,
    ADD
};

class segTree{
    int N;

    int64_t *tree;
    pair<rangeOperaion, int64_t> *lazy;
    const pair<rangeOperaion, int64_t> nullopr=make_pair(NUL, 0);
    pair<int, int> *range;

    int getParent(int child){
        return child/2;
    }
    pair<int,int> getChildren(int parent){
        return make_pair(2*parent, 2*parent+1);
    }
    int lg(int64_t N){
        int lgN;
        for(lgN=0;(1<<lgN)<N;lgN++);
        return lgN;
    }

    void setLazy(int pos, pair<rangeOperaion, int64_t> val){
        if(val.first==UPDATE) lazy[pos]=val;
        else if(lazy[pos].first==NUL) lazy[pos]=val;
        else lazy[pos].second+=val.second;
    }
    void eval(int pos){
        if(lazy[pos].first==NUL) return;
        if(pos<N){
            setLazy(getChildren(pos).first, lazy[pos]);
            setLazy(getChildren(pos).second, lazy[pos]);
        }
        if(lazy[pos].first==UPDATE){
            tree[pos]=lazy[pos].second*(range[pos].second-range[pos].first);
        }else{
            tree[pos]+=lazy[pos].second*(range[pos].second-range[pos].first);
        }
        lazy[pos]=nullopr;
        tree[pos] %= M;
    }

    void operate(int64_t val, int pos, int left, int right, rangeOperaion op){
        eval(pos);
        if(right<=range[pos].first || range[pos].second<=left) return;
        if(left<=range[pos].first && range[pos].second<=right){
            setLazy(pos, make_pair(op, val));
            eval(pos);
            return;
        }
        operate(val, getChildren(pos).first, left, right, op);
        operate(val, getChildren(pos).second, left, right, op);
        tree[pos] = tree[getChildren(pos).first] + tree[getChildren(pos).second];
        tree[pos] %= M;
    }

    int64_t get(int pos, int left, int right){
        eval(pos);
        if(right<=range[pos].first || range[pos].second<=left) return 0;
        if(left<=range[pos].first && range[pos].second<=right) return tree[pos];
        return get(getChildren(pos).first, left, right) + get(getChildren(pos).second, left, right);
    }

    public:
    segTree(int n){
        N=(1LL<<lg(n));
        if(N<n) N*=2;
        tree=new int64_t[2*N];
        lazy=new pair<rangeOperaion,int64_t>[2*N];
        range=new pair<int,int>[2*N];

        for(int i=1;i<2*N;i++){
            tree[i]=0;
            lazy[i]=nullopr;
        }
        for(int i=2*N-1;i>0;i--){
            if(i>=N) range[i]=make_pair(i-N, i-N+1);
            else range[i]=make_pair(range[getChildren(i).first].first, range[getChildren(i).second].second);
        }
    }
    ~segTree(){
        delete[] tree;
        delete[] lazy;
        delete[] range;
    }
    void update(int64_t value, int left, int right){
        //assert(0<=left && left<=right && right<=N);
        if(left >= right) return;
        operate(value, 1, left, right, UPDATE);
    }
    void add(int64_t value, int left, int right){
        //assert(0<=left && left<=right && right<=N);
        if(left >= right) return;
        operate(value, 1, left, right, ADD);
    }
    void update(int64_t value, int pos){
        update(value, pos, pos+1);
    }
    void add(int64_t value, int pos){
        add(value, pos, pos+1);
    }
    int64_t queue(int left, int right){
        return get(1, left, right);
    }
    int64_t queue(int pos){
        return get(1, pos, pos+1);
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int N;
    string s;
    cin >> N;
    cin >> s;

    segTree dp[2] = {3000, 3000};

    for(int i=0;i<N;i++) dp[0].update(1, i);
    for(int i=1;i<N;i++){
        dp[i%2].update(0, 0, N);
        for(int j=0;j<=N-i;j++){
            if(s[i-1]=='<'){
                dp[i%2].add(dp[(i+1)%2].queue(j), 0, j);
            }else{
                dp[i%2].add(dp[(i+1)%2].queue(j), j, N-i);
            }
        }
    }

    cout << dp[(N+1)%2].queue(0) << endl;
    return 0;
}

Measured memory_bytes: 768