Let N be a positive integer. You are given a string s of length N - 1, consisting of `<` and `>`.

Find the number of permutations (p_1, p_2, \ldots, p_N) of (1, 2, \ldots, N) that satisfy the following condition, modulo 10^9 + 7:

* For each i (1 \leq i \leq N - 1), p_i < p_{i + 1} if the i-th character in s is `<`, and p_i > p_{i + 1} if the i-th character in s is `>`.

Constraints

* N is an integer.
* 2 \leq N \leq 3000
* s is a string of length N - 1.
* s consists of `<` and `>`.

Input

Input is given from Standard Input in the following format:


N
s


Output

Print the number of permutations that satisfy the condition, modulo 10^9 + 7.

Examples

Input

4
<><


Output

5


Input

5
<<<<


Output

1


Input

20
>>>><>>><>><>>><<>>


Output

217136290
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        String S = sc.next();
        long[] dpPrev = new long[N + 1];
        // A state is, for the current position in the permutation,
        // and many available seats above and below me, how many ways to REACH
        // So, this is a PULL-DP. Where we take the previous distribution,
        // then move it to some other form! The actual numbers don't matter!

        // Base case, we choose any place, thus losing the first spot
        for (int below = 0; below < N; below++) {
            // The total remaining spots is N - 1, after this first case
            dpPrev[below]++;
        }
//        System.out.println(Arrays.toString(dpPrev));
        // Now, we transition N - 1 times, so that no more is left
        for (int pos = 0; pos < N - 1; pos++) {
            long[] dpNext = new long[N + 1];
            // Prefix sum optimization
            int remaining = N - 1 - pos;
            int maxBelow = remaining - 1;
            if (S.charAt(pos) == '<') {
                // We need to move up!
                // We will shift to have any number of below to anything
                // all the way up to the MAX below
                // [currBelow, maxBelow]

                for (int below = 0; below <= remaining; below++) {
                    dpNext[below] = addSelf(dpNext[below], dpPrev[below]);
                    dpNext[maxBelow + 1] = subSelf(dpNext[maxBelow + 1], dpPrev[below]);
                }
            }
            else {
                // We are moving down!
                // So, all smaller below values will be incremented
                // [0, below - 1], since we can't keep the SAME below,
                // if we necessarily lose one at least
                for (int below = 0; below <= remaining; below++) {
                    dpNext[0] = addSelf(dpNext[0], dpPrev[below]);
                    dpNext[below] = subSelf(dpNext[below], dpPrev[below]);
                }
            }
            for (int i = 1; i < remaining; i++) {
                dpNext[i] = addSelf(dpNext[i], dpNext[i - 1]);
            }
            for (int i = 0; i < remaining; i++) {
                dpPrev[i] = dpNext[i];
            }
//            System.out.println(Arrays.toString(dpPrev));
        }
        out.println(dpPrev[0]);
        out.close();
    }

    static long mod = (long) 1e9 + 7;
    static long addSelf(long val, long add) {
        val += add;
        if (val >= mod) {
            val -= mod;
        }
        return val;
    }

    static long subSelf(long val, long sub) {
        val -= sub;
        if (val < 0) {
            val += mod;
        }
        return val;
    }

    static class FastScanner {
        public int BS = 1<<16;
        public char NC = (char)0;
        byte[] buf = new byte[BS];
        int bId = 0, size = 0;
        char c = NC;
        double cnt = 1;
        BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            }
            catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar(){
            while(bId==size) {
                try {
                    size = in.read(buf);
                }catch(Exception e) {
                    return NC;
                }
                if(size==-1)return NC;
                bId=0;
            }
            return (char)buf[bId++];
        }

        public int nextInt() {
            return (int)nextLong();
        }

        public long nextLong() {
            cnt=1;
            boolean neg = false;
            if(c==NC)c=getChar();
            for(;(c<'0' || c>'9'); c = getChar()) {
                if(c=='-')neg=true;
            }
            long res = 0;
            for(; c>='0' && c <='9'; c=getChar()) {
                res = (res<<3)+(res<<1)+c-'0';
                cnt*=10;
            }
            return neg?-res:res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c!='.' ? cur:cur+nextLong()/cnt;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c>32) {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c!='\n') {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if(c>32)return true;
            while(true) {
                c=getChar();
                if(c==NC)return false;
                else if(c>32)return true;
            }
        }
    }
}