Dispersed parentheses
시간 제한1초메모리 제한1024 MB
기호 0, (, )로 이루어진 길이 n 문자열 가운데 깊이가 정확히 k인 분산 괄호 수열의 개수를 1e9+9로 나눈 나머지를 구한다.
문제
The sequence of calculations in arithmetic expressions is usually set by a certain arrangement of parentheses. For example, . After deleting all the elements from the expression except parentheses remaining symbols form a parentheses sequence . Let’s assume that adding character <<>> does not corrupt the sequence. Let’s call such sequence a disperse parentheses sequence. Also this can be defined as follows:
- An empty line is a disperse parentheses sequence.
- If and --- disperse parentheses sequences, then lines and are also disperse parentheses sequences.
The depth of disperse parentheses sequence is the maximum difference between the number of opening and closing parentheses in the sequence prefix. (The prefix of line is the line, which can be obtained from by deleting symbols from the tail of the line. For example, the prefixes of line «» are lines <<>>, <<>>, <<>>, <<>>, <<>> and <<>>). Thus, the depth of the sequence «» equals two (prefix «» contains three openinig and one closing parentheses).
Calculate the number of possible disperse parentheses sequences symbols long, that have a depth .
입력
Single line contains space-separated integers and (, ).
출력
Output the number of possible disperse parentheses sequences symbols long, that have a depth modulo ().