Competitions
Азербайджан - подготовка. Март 18
Catalan numbers
Catalan numbers cn
are given by recurrence relation:
Compute the n-th Catalan numbers modulo m.
Input
Two integers n (0 ≤ n ≤ 104
) and m (0 < m ≤ 109
).
Output
Print the value of cn
mod m.
Input example #1
5 100
Output example #1
42