{"raw_statement":[{"iden":"problem statement","content":"Given are $M$ digits $C_i$.\nFind the sum, modulo $998244353$, of all integers between $1$ and $N$ (inclusive) that contain all of $C_1, \\ldots, C_M$ when written in base $10$ without unnecessary leading zeros."},{"iden":"constraints","content":"*   $1 \\leq N < 10^{10^4}$\n*   $1 \\leq M \\leq 10$\n*   $0 \\leq C_1 < \\ldots < C_M \\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$M$\n$C_1$ $\\ldots$ $C_M$"},{"iden":"sample input 1","content":"104\n2\n0 1"},{"iden":"sample output 1","content":"520\n\nBetween $1$ and $104$, there are six integers that contain both `0` and `1` when written in base $10$: $10,100,101,102,103,104$.  \nThe sum of them is $520$."},{"iden":"sample input 2","content":"999\n4\n1 2 3 4"},{"iden":"sample output 2","content":"0\n\nBetween $1$ and $999$, no integer contains all of `1`, `2`, `3`, `4`."},{"iden":"sample input 3","content":"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n5\n0 2 4 6 8"},{"iden":"sample output 3","content":"397365274\n\nBe sure to find the sum modulo $998244353$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}