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
import java.util.*;
import java.io.*;

class Mod{
    static final int MOD = 1000_000_007;
    static final long[] fact = makeFactorialArray(1000000);
    static final long[] factInv = makeInversedArray(fact);

    public static long add(long a, long b){
        long tmp = (a+b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long sub(long a, long b){
        return add(a,-b);
    }
    public static long mult(long a, long b){
        long tmp = (a*b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long power(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
            long half = power(a,x/2);
            return mult(half,half);
        }
        return (a*power(a,x-1)) % MOD;
    }
    public static long inverse(long a){
        return power(a,MOD-2);
    }
    public static long div(long a, long b){
        return mult(a, inverse(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
            array[i]=mult(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
            array[i] = inverse(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r){
        if(n<0 || r<0 || n<r) return 0;
        return mult(fact[n], mult(factInv[r],factInv[n-r]));
    }
    public static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return (a/gcd(a,b))*b;
    }

}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String s = sc.next();

        long[][] dp = new long[N][N];
        //dp[i][j] : the way of arranging 'i' elements where 'j' elms are greater than p[i-1]
        //0<= i <N, 0<= j <=N-i

        Arrays.fill(dp[0],1);
        for(int n=1; n<N; n++){
            boolean gt = s.charAt(n-1)=='<';
            if(gt){
                dp[n][N-n] = 0;
                for(int j=N-n-1; j>=0; j--){
                    //dp[n][j] = dp[n-1][j] + dp[n-1][j+1] + ... + dp[n-1][N-n]
                    dp[n][j] = Mod.add(dp[n][j+1], dp[n-1][j+1]);
                    //System.err.printf("<%d %d %d\n", n,j,dp[n][j]);
                }
            }else{
                dp[n][0] = dp[n-1][0];
                for(int j=1; j<N-n; j++){
                    //dp[n][j] = dp[n-1][0] + dp[n-1][1] + ... + dp[n-1][j]
                    dp[n][j] = Mod.add(dp[n][j-1], dp[n-1][j]);
                    //System.err.printf(">%d %d %d\n", n,j,dp[n][j]);
                }
            }
        }


        //for(int n=0; n<N; n++) System.err.println(Arrays.toString(dp[n]));
        System.out.println(dp[N-1][0]);


    }
}
