Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

SIZE=10000; MOD=10**9+7 #ここを変更する

inv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD
fac = [0]*(SIZE+1)# fac[j] = j! mod MOD
finv = [0]*(SIZE+1)# finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE+1):
    inv[i] = MOD -(MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

import sys
sys.setrecursionlimit(10**7)

n=int(input())
s=input()


memo = [[0]*(i+1) for i in range(n+1)]
 
def dp(r,l):
    if r-l<=2:
        memo[r][l] = 1
        return 1
    if memo[r][l] > 0:
        return memo[r][l]
    
    res = 0
    pt = l
    now = "<"
    while pt <= r-1:
        if pt < r-1 and s[pt] == "<":
            now = "<"
        else:
            if now  == "<":
#                print(pt,r,l)
                res += dp(r,pt+1) * dp(pt,l) * choose(r-l-1, pt-l)
                res %= MOD
            now = ">"    
        pt += 1

    
    memo[r][l] = res
    return res
 
dp(n,0)
#print(memo)
print(memo[n][0])







Fixed submission:
# coding: utf-8
# Your code here!
n=int(input())
s=input()
MOD = 10**9+7

dp = [1]*n

for i,c in enumerate(s):
    if c == "<":
        ssum = sum(dp[1:n-i])
        ssum %= MOD
        for j in range(n-i-1):
            dp[j] = ssum
            ssum -= dp[j+1]
            ssum %= MOD

    else:
        ssum = dp[0]
        for j in range(n-i-1):
            dp[j] = ssum
            ssum += dp[j+1]
            ssum %= MOD

#    print(dp)


print(dp[0])

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

SIZE=10000; MOD=10**9+7 #ここを変更する

inv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD
fac = [0]*(SIZE+1)# fac[j] = j! mod MOD
finv = [0]*(SIZE+1)# finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE+1):
    inv[i] = MOD -(MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD

def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0

import sys
sys.setrecursionlimit(10**7)

n=int(input())
s=input()


memo = [[0]*(i+1) for i in range(n+1)]
 
def dp(r,l):
    if r-l<=2:
        memo[r][l] = 1
        return 1
    if memo[r][l] > 0:
        return memo[r][l]
    
    res = 0
    pt = l
    now = "<"
    while pt <= r-1:
        if pt < r-1 and s[pt] == "<":
            now = "<"
        else:
            if now  == "<":
#                print(pt,r,l)
                res += dp(r,pt+1) * dp(pt,l) * choose(r-l-1, pt-l)
                res %= MOD
            now = ">"    
        pt += 1

    
    memo[r][l] = res
    return res
 
dp(n,0)
#print(memo)
print(memo[n][0])







Fixed submission:
# coding: utf-8
# Your code here!
n=int(input())
s=input()
MOD = 10**9+7

dp = [1]*n

for i,c in enumerate(s):
    if c == "<":
        ssum = sum(dp[1:n-i])
        ssum %= MOD
        for j in range(n-i-1):
            dp[j] = ssum
            ssum -= dp[j+1]
            ssum %= MOD

    else:
        ssum = dp[0]
        for j in range(n-i-1):
            dp[j] = ssum
            ssum += dp[j+1]
            ssum %= MOD

#    print(dp)


print(dp[0])