{"raw_statement":[{"iden":"problem statement","content":"We have a sequence of $N$ integers between $0$ and $9$ (inclusive): $A=(A_1, \\dots, A_N)$, arranged from left to right in this order.\nUntil the length of the sequence becomes $1$, we will repeatedly do the operation $F$ or $G$ below.\n\n*   Operation $F$: delete the leftmost two values (let us call them $x$ and $y$) and then insert $(x+y)\\%10$ to the left end.\n*   Operation $G$: delete the leftmost two values (let us call them $x$ and $y$) and then insert $(x\\times y)\\%10$ to the left end.\n\nHere, $a\\%b$ denotes the remainder when $a$ is divided by $b$.\nFor each $K=0,1,\\dots,9$, answer the following question.\n\n> Among the $2^{N-1}$ possible ways in which we do the operations, how many end up with $K$ being the final value of the sequence?  \n> Since the answer can be enormous, find it modulo $998244353$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 10^5$\n*   $0 \\leq A_i \\leq 9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $\\dots$ $A_N$"},{"iden":"sample input 1","content":"3\n2 7 6"},{"iden":"sample output 1","content":"1\n0\n0\n0\n2\n1\n0\n0\n0\n0\n\nIf we do Operation $F$ first and Operation $F$ second: the sequence becomes $(2,7,6)→(9,6)→(5)$.  \nIf we do Operation $F$ first and Operation $G$ second: the sequence becomes $(2,7,6)→(9,6)→(4)$.  \nIf we do Operation $G$ first and Operation $F$ second: the sequence becomes $(2,7,6)→(4,6)→(0)$.  \nIf we do Operation $G$ first and Operation $G$ second: the sequence becomes $(2,7,6)→(4,6)→(4)$."},{"iden":"sample input 2","content":"5\n0 1 2 3 4"},{"iden":"sample output 2","content":"6\n0\n1\n1\n4\n0\n1\n1\n0\n2"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}