{"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\"\u003eGiven a function $f(x) \u003d \\frac{b}{c + e^{ax+d}}$, where $a \\not \\equiv 0 \\pmod{998244353}$. \u003cbr\u003e\u003cbr\u003eDenote $x_0$ as the smallest real solution of the equation: $ax+d\u003d0$, and note that the solution always exists. \u003cbr\u003e\u003cbr\u003eOutput the coefficient of the item $(x-x_0)^n$ in the Taylor series of $f(x)$ at $x\u003dx_0$. The answer may be very large, so you just need to output the answer modulo $998244353$.\u003cbr\u003e\u003cbr\u003eNote that for the given $n$, your task is to answer $q$ queries which share the same parameter $n$.\u003cbr\u003e\u003cbr\u003eNote that it is not guaranteed that the answer could be represented as rational fraction $\\frac{p}{q}$ where $gcd(p,q)\u003d1$, or $q$ has no multiplicative inverse element modulo $998244353$. If it can, print it as $pq^{-1}$ modulo $998244353$ which is not negative. Otherwise just print $-1$.\u003cbr\u003e\u003cbr\u003eIf you knew little about $gcd$ in mathematic, please refer to \u003cb\u003ehttps://en.wikipedia.org/wiki/Greatest_common_divisor\u003c/b\u003e\u003cbr\u003e\u003cbr\u003eIf you knew little about $Taylor\\_series$ in mathematic, please refer to \u003cb\u003ehttps://en.wikipedia.org/wiki/Taylor_series\u003c/b\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases.\u003cbr\u003e\u003cbr\u003eEach case starts with a line containing two integers $n$ and $q$ seperated by a space.\u003cbr\u003e\u003cbr\u003eNext $q$ lines in every test case will include four integers $a$, $b$, $c$, $d$ per line, seperated by $3$ spaces.\u003cbr\u003e\u003cbr\u003eIt is guaranteed that $\\forall t \\in \\{a,b,c,d\\},|t| \\le 10^9$ and $n,q \\in [0,5 \\times 10^4]$.\u003cbr\u003e\u003cbr\u003eIt is guaranteed that the sum of $n$ and the sum of $q$ in all test cases are both no larger than $3 \\times 10^5$."}},{"title":"Output","value":{"format":"HTML","content":"For each query in each test case, output the only line containing just one integer denoting the answer if there would be, or $-1$ otherwise."}},{"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\u003e0 1\r\n1 1 1 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e499122177\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}