Given a natural number
,
compute the number of correct parenthesizations with
opening and
closing parentheses, with just one restriction: the substring
“)()” is not allowed.
For instance, for
there are four correct parenthesizations: “(((())))”,
“(()(()))”, “(())(())” and
“()((()))”.
Input consists of several cases, each one with an between 1 and .
For each , print the result modulo .
Input
4 1 2 3 5 10000
Output
4 1 1 2 9 681928184