{"raw_statement":[{"iden":"problem statement","content":"You are given $N$ length-$M$ sequences, where each element is $0$ or $1$. The $i$\\-th sequence is $A_i = (A_{i, 1}, A_{i, 2}, \\dots, A_{i, M})$.\nFor integers $i, j \\ (1 \\leq i, j \\leq N)$, define $f(i, j)$ as follows:\n\n*   $f(i, j) :=$ The smallest non-negative integer $x$ such that $A_i$ and $A_j$ become identical after performing the following operation $x$ times, or $0$ if such $x$ does not exist.\n    *   For all integers $k \\ (1 \\leq k \\leq M)$ simultaneously, replace $A_{i, k}$ with $\\displaystyle \\left (\\sum_{l=1}^{k} A_{i, l} \\right ) \\bmod 2$.\n\nFind $\\displaystyle \\sum_{i=1}^{N} \\sum_{j=i}^{N} f(i, j)$, modulo $998244353$."},{"iden":"constraints","content":"*   $1 \\leq N \\times M \\leq 10^6$\n*   $A_{i, j} \\in {0, 1}$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_{1, 1}$ $A_{1, 2}$ $\\cdots$ $A_{1, M}$\n$A_{2, 1}$ $A_{2, 2}$ $\\cdots$ $A_{2, M}$\n$\\vdots$\n$A_{N, 1}$ $A_{N, 2}$ $\\cdots$ $A_{N, M}$"},{"iden":"sample input 1","content":"4 3\n1 0 0\n1 1 0\n1 0 1\n0 1 1"},{"iden":"sample output 1","content":"8\n\n$f(1, 1) = 0$, $f(1, 2) = 3$, $f(1, 3) = 2$, $f(1, 4) = 0$, $f(2, 2) = 0$, $f(2, 3) = 3$, $f(2, 4) = 0$, $f(3, 3) = 0$, $f(3, 4) = 0$, $f(4, 4) = 0$, so print their sum, $8$."},{"iden":"sample input 2","content":"7 6\n1 0 0 0 0 0\n1 1 1 0 0 0\n1 0 1 1 0 0\n1 0 0 0 1 1\n1 0 0 0 0 1\n1 0 0 0 0 0\n1 1 1 1 1 1"},{"iden":"sample output 2","content":"6"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}