{"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\"\u003eYou have a grid of $n$ rows and $m$ columns, each cell should be painted either black or white.\u003cbr\u003eThe cell in the $i$th row and $j$th column is denoted as $(i,j)$.\u003cbr\u003eTwo cells are $directly$ $connected$ if and only if they have a common edge and have the same color.\u003cbr\u003eTwo cells are $connected$ if and only if they are $directly$ $connected$ or there exist a cell $connected$ to both cells.\u003cbr\u003eA painting plan is $good$ if and only if it satisfy three conditions:\u003cbr\u003e1. All white cells are $connected$ \u003cbr\u003e2. All black cells are $connected$\u003cbr\u003e3. $\\forall 1 \\leq i \u0026lt; n,1 \\leq j \u0026lt; m$, cell$(i,j)$,$(i,j+1)$,$(i+1,j)$and$(i+1,j+1)$ can\u0027t have the same color.\u003cbr\u003eSome of the cells have been painted, you should paint the rest .\u003cbr\u003eoutput the number of $good$ painting plans module $998244353$.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of input contains an integer $T(T \\leq 10)$, denoting the number of test cases.\u003cbr\u003eEach test case contains $n+1$ lines.\u003cbr\u003eThe first line contains two integer $n, m(3 \\leq n \\leq 100,3 \\leq m \\leq 100, n*m\u0026lt;\u003d100)$, denoting the size of the grid. \u003cbr\u003eThe next $n$ lines describe the painted cells, each line contains $m$ integer. \u003cbr\u003eThe $j$th number in $i$th row describe cell$(i,j)$,the number is $0$,$1$ or $-1$.\u003cbr\u003e$0$ means the cell is painted white,$1$ means the cell is painted black, $-1$ means the cell is not painted.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Output the number of $good$ painting plans module $998244353$.\u003cbr\u003e"}},{"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\u003e3\r\n3 3\r\n1 0 0\r\n1 1 0\r\n-1 -1 0\r\n3 4\r\n1 -1 -1 0\r\n-1 -1 -1 -1\r\n0 -1 -1 1\r\n10 10\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n0\r\n139719073\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}