402044: GYM100633 B Dispersed parentheses

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Dispersed parenthesestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The sequence of calculations in arithmetic expressions is usually set by a certain arrangement of parentheses. For example, (3·(2 + 1))·(4 - 5). After deleting all the elements from the expression except parentheses remaining symbols form a parentheses sequence (())(). Let’s assume that adding character «0» 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 S and T — disperse parentheses sequences, then lines 0S, S0, (S) and ST 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 S is the line, which can be obtained from S by deleting symbols from the tail of the line. For example, the prefixes of line «ABCAB» are lines «», «A», «AB», «ABC», «ABCA» and «ABCAB».) Thus, the depth of the sequence «(0)(0())0» equals two (prefix «(0)(0(» contains three openinig and one closing parentheses).

Calculate the number of possible disperse parentheses sequences n symbols long, that have a depth k.

Input

Single line contains space-separated integers n and k (1 ≤ n ≤ 300, 0 ≤ k ≤ n).

Output

Output the number of possible disperse parentheses sequences n symbols long, that have a depth k modulo (109 + 9).

ExamplesInput
3 0
Output
1
Input
3 1
Output
3
Input
3 2
Output
0

加入题单

上一题 下一题 算法标签: