Score : 100 points
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:
<
, and p_i > p_{i + 1} if the i-th character in s is >
.<
and >
.Input is given from Standard Input in the following format:
N s
Print the number of permutations that satisfy the condition, modulo 10^9 + 7.
4 <><
5
There are five permutations that satisfy the condition, as follows:
5 <<<<
1
There is one permutation that satisfies the condition, as follows:
20 >>>><>>><>><>>><<>>
217136290
Be sure to print the number modulo 10^9 + 7.