{"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 grid with n*m grid points and (n-1)*(m-1) blocks. There may be a number of 0 or 1 in some block, represents the number of lines surround this block is odd or even.(0 for even and 1 for odd) When there is no number, there is no limit to the number of lines surround this block.\u003cbr\u003e\u003cbr\u003eYou have to draw lines between the grid points to form several cycles (a cycle in the grid is a non-empty trail in which the only repeated grid points are the first and last grid points). Two cycles can share grid points but can not share lines.\u003cbr\u003e\u003cbr\u003ePlease find the number of different solution modulo 998244353. When a line exists in one solution and does not exist in the other solution, the two solutions are considered different.\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/a237d44ad1638a01e608311230e0db09?v\u003d1714803486\"\u003e\u003c/center\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains a single integer t (t\u0026lt;\u003d100) representing the number of test cases in the input. Then t test cases follow. \u003cbr\u003e\u003cbr\u003eThe first line of each test case contains two integers n and m (2\u0026lt;\u003dn,m\u0026lt;\u003d17) representing the height and width of the grid. \u003cbr\u003e\u003cbr\u003eThen n-1 lines followed. The i-th of these lines contains m-1 integers, representing the number in the grid. If there is no number, use \u0027.\u0027 instead.\u003cbr\u003e\u003cbr\u003eThe number of test witch n, m\u0026gt;\u003d10 does not exceed 5."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print one integer in one line, which is the answer modulo 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\n3 3\r\n01\r\n1.\r\n3 4\r\n111\r\n1..\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}