{"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\"\u003eNeko and Inu are good friends.\u003cbr\u003eNeko has a box of energy crystals $A$. Inu has a box of energy crystals $B$.\u003cbr\u003eBoth of $A$ and $B$ have $n$ crystals. Each crystal has a different energy. You can think that energy is a positive integer.\u003cbr\u003eUnfortunately, $A$ and $B$ are mixed together when Neko and Inu are playing games. Each pair of crystals $u (u \\in A)$ and $v (v \\in B)$ can produce two new crystals which energies are $u + v$ and $|u - v|$. The old crystals will disappear in the end.\u003cbr\u003eSo there are $2 n ^ {2}$ crystals finally. Let the new box of energy crystals called $C$. Neko and Inu are surprised to find each crystal in $C$ is different and their energies are continuous odd number from $1$ to $4 n ^ {2} - 1$.\u003cbr\u003eNow, Neko and Inu want to know how many different $A$ and $B$ can be mixed into $C$. Calculate the answer after mod $998244353$.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains only one integer $T ( T \\leq 50)$, which indicates the number of test cases. \u003cbr\u003eFor each test case, the first line contains one integer $m$ ,indicating the number of distinct primes of $n$.($1 \\leq m \\leq 10^5$).\u003cbr\u003eThe next $m$ line, each line contains two integers $p_{i}, a_{i}$.\u003cbr\u003eWhere $p_{i}$ is a prime.$n \u003d \\prod p_{i} ^ {a_{i}}, a_{i} \u0026gt; 0, \\sum a_{i} \\leq 10^5, p_{i} \\leq 10^9 + 9$.\u003cbr\u003eThere are at most $10$ test cases which satisfies $\\sum a_{i} \\geq 10^3$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output one line \"Case #x: y\", where x is the case number (starting from 1) and y is the answer after mod $998244353$."}},{"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\u003e2\r\n1\r\n2 1\r\n2\r\n2 2\r\n5 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 6\r\nCase #2: 6060\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003efor the first case:\u003cbr\u003eA \u003d {1, 3}, B \u003d {4, 12}\u003cbr\u003eA \u003d {4, 12}, B \u003d {1, 3}\u003cbr\u003eA \u003d {3, 5}, B \u003d {6, 10}\u003cbr\u003eA \u003d {6, 10}, B \u003d {3, 5}\u003cbr\u003eA \u003d {2, 6}, B \u003d {7, 9}\u003cbr\u003eA \u003d {7, 9}, B \u003d {2, 6}\u003cbr\u003e"}}]}