{"raw_statement":[{"iden":"problem statement","content":"You are given an integer $N$ and a prime $P$.\nFor a tree with $N$ vertices labeled $1$ through $N$, let $a_i$ and $b_i$ be the endpoints of the $i$\\-th edge $(1 \\leq i \\leq N-1)$. Also, define $x_j\\ (1 \\leq j \\leq N-1)$ as:\n\n*   The number of integers $i\\ (1 \\leq i \\leq N-1)$ satisfying $\\min(a_i,b_i) \\leq j \\lt \\max(a_i,b_i)$.\n\nFind the number, modulo $P$, of sequences that could be $(x_1, x_2, \\ldots, x_{N - 1})$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 500$\n*   $10^8 \\leq P \\leq 10^9$\n*   $P$ is prime."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $P$"},{"iden":"sample input 1","content":"3 998244353"},{"iden":"sample output 1","content":"3\n\nThere are three different trees with three vertices, if we distinguish the vertices by their labels but not the edges.  \nThe corresponding $(x_1, x_2)$ are $(1, 1)$, $(2, 1)$, and $(1, 2)$, so the expected output is $3$ modulo $P = 998244353$."},{"iden":"sample input 2","content":"69 433416647"},{"iden":"sample output 2","content":"243082757\n\nFind the count modulo $P$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}