{"raw_statement":[{"iden":"problem statement","content":"We have a string $S$. Initially, $S=$ `1`.  \nProcess $Q$ queries in the following formats in order.\n\n*   `1 x` : Append a digit $x$ at the end of $S$.\n*   `2` : Delete the digit at the beginning of $S$.\n*   `3` : Print the number represented by $S$ in decimal, modulo $998244353$."},{"iden":"constraints","content":"*   $1 \\leq Q \\leq 6 \\times 10^5$\n*   For each query in the first format, $x \\in {1,2,3,4,5,6,7,8,9}$.\n*   A query in the second format is given only if $S$ has a length of $2$ or greater.\n*   There is at least one query in the third format."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$Q$\n$\\mathrm{query}_1$\n$\\vdots$\n$\\mathrm{query}_Q$\n\nHere, $\\mathrm{query}_i$ denotes the $i$\\-th query, which is in one of the following formats:\n\n$1$ $x$\n\n$2$\n\n$3$"},{"iden":"sample input 1","content":"3\n3\n1 2\n3"},{"iden":"sample output 1","content":"1\n12\n\nIn the first query, $S$ is `1`, so you should print $1$ modulo $998244353$, that is, $1$.  \nIn the second query, $S$ becomes `12`.  \nIn the third query, $S$ is `12`, so you should print $12$ modulo $998244353$, that is, $12$."},{"iden":"sample input 2","content":"3\n1 5\n2\n3"},{"iden":"sample output 2","content":"5"},{"iden":"sample input 3","content":"11\n1 9\n1 9\n1 8\n1 2\n1 4\n1 4\n1 3\n1 5\n1 3\n2\n3"},{"iden":"sample output 3","content":"0\n\nBe sure to print numbers modulo $998244353$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}