{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eLet $m(x)$ be the \u003ci\u003emode\u003c/i\u003e of the digits in decimal representation of positive integer $x$. The mode is the largest value that occurs most frequently in the sequence. For example, $m(15532)\u003d5$, $m(25252)\u003d2$, $m(103000)\u003d0$, $m(364364)\u003d6$, $m(114514)\u003d1$, $m(889464)\u003d8$.\u003c/p\u003e\n\u003cp\u003eGiven a positive integer $n$, DreamGrid would like to know the value of $(\\sum\\limits_{x\u003d1}^{n} m(x)) \\bmod (10^9+7)$.\u003c/p\u003e\n\n\u003ch4\u003eInput\u003c/h4\u003e\n\u003cp\u003eThere are multiple test cases. The first line of the input contains an integer $T$, indicating the number of test cases. For each test case:\u003c/p\u003e\n\u003cp\u003eThe first line contains a positive integer $n$ ($1 \\le n \u0026lt; 10^{50}$) without leading zeros.\u003c/p\u003e\n\u003cp\u003eIt\u0027s guaranteed that the sum of $|n|$ of all test cases will not exceed $50$, where $|n|$ indicates the number of digits of $n$ in decimal representation.\u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\u003cp\u003eFor each test case output one line containing one integer, indicating the value of $(\\sum\\limits_{x\u003d1}^{n} m(x)) \\bmod (10^9+7)$.\u003c/p\u003e\n\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\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\u003e5\n9\n99\n999\n99999\n999999\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e45\n615\n6570\n597600\n5689830\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n"}}]}