Consider a sequence ⟨a_1,a_2,…,a_n⟩ of non-negative integers. An ascent in the sequence is a pair of adjacent elements such that the element with greater index has greater value. For example, there are two ascents in sequence ⟨0,2,3,1,0⟩: a_1=0 to a_2=2, and a_2=2 to a_3=3. Let us denote the number of ascents among the first k elements of the sequence by A_k. In the given example, A_1=0, A_2=1, A_3=2, A_4=2 and A_5=2.
Sequence a is called an ascent sequence if a_1=0 and for every i≥2 inequality a_i≤A_i−1+1 is satisfied. For example, sequence ⟨0,2,3,1,0⟩ is not an ascent sequence because a_2=2 and A_1=0. Sequence ⟨0,1,0,2,3⟩ is, in turn, an ascent sequence because A_1=0, A_2=1, A_3=1, A_4=2.
Sequence ⟨a_1,a_2,…,a_n⟩ of non-negative integers avoids pattern 201 if there are no i, j and k such that i<j<k and a_j<a_k<a_i. For example, sequence ⟨0,1,0,2,3⟩ avoids pattern 201, while ⟨0,1,2,3,1,0,2⟩ does not avoid pattern 201 because for i=4, j=6, k=7 we have a_j=0<a_k=2<a_i=3.
You are given two integers n and p. Find the number of ascent sequences of length n avoiding pattern 201, and output this number modulo p.
The only line of the input contains two integers n and p (1≤n≤500; 2≤p≤109+123; p is a prime).
Output a single integer --- the number of ascent sequences of length n avoiding pattern 201, modulo p.
In the first example test case, there are five ascent sequences of length 3 avoiding pattern 201: ⟨0,0,0⟩, ⟨0,0,1⟩, ⟨0,1,0⟩, ⟨0,1,1⟩, ⟨0,1,2⟩.
In the second example test case, there are 53 ascent sequences of length 5 and all of them except ⟨0,1,2,0,1⟩ avoid pattern 201.