{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eWhen Tonyfang was studying monotonous queues, he came across the following problem:\u003cbr\u003eFor a permutation of length n $a_1,a_2...a_n$, define $l_i$ as maximum x satisfying $x\u0026lt;i$ and $a_x\u0026gt;a_i$, or 0 if such x not exists, $r_i$ as minimum x satisfying $x\u0026gt;i$ and $a_x \u0026gt; a_i$, or n+1 if not exists. Output $\\sum_{i\u003d1}^n \\min(i-l_i,r_i-i)$.\u003cbr\u003eObviously, this problem is too easy for Tonyfang. So he thought about a harder version:\u003cbr\u003eGiven two integers n and x, counting the number of permutations of 1 to n which $\\sum_{i\u003d1}^n \\min(i-l_i,r_i-i)\u003dx$ where l and r are defined as above, output the number mod P.\u003cbr\u003eTonyfang solved it quickly, now comes your turn!\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"In the first line, before every test case, an integer P.\u003cbr\u003eThere are multiple test cases, please read till the end of input file.\u003cbr\u003eFor every test case, a line contain three integers n and x, separated with space.\u003cbr\u003e$1 \\leq n \\leq 200, 1 \\leq x \\leq 10^9$. P is a prime and $10^8 \\leq P \\leq 10^9$, No more than 10 test cases."}},{"title":"Output","value":{"format":"HTML","content":"For every test case, output the number of valid permutations modulo P."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e998244353\r\n3 4\r\n3 233\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}