{"problem":{"name":"[SNCPC2019] Digit Mode","description":{"content":"Let $m(x)$ be the $\\textit{mode}$ 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)=5$,","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P5"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9640"},"statements":[{"statement_type":"Markdown","content":"Let $m(x)$ be the $\\textit{mode}$ 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)=5$, $m(25252)=2$, $m(103000)=0$, $m(364364)=6$, $m(114514)=1$, $m(889464)=8$.\n\nGiven a positive integer $n$, DreamGrid would like to know the value of $(\\sum\\limits_{x=1}^{n} m(x)) \\bmod (10^9+7)$.\n\n## Input\n\nThere are multiple test cases. The first line of the input contains an integer $T$, indicating the number of test cases. For each test case:\n\nThe first line contains a positive integer $n$ ($1 \\le n < 10^{50}$) without leading zeros.\n\nIt's 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.\n\n## Output\n\nFor each test case output one line containing one integer, indicating the value of $(\\sum\\limits_{x=1}^{n} m(x)) \\bmod (10^9+7)$.\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9640","tags":["2019","O2优化","数位 DP","陕西","省赛/邀请赛"],"sample_group":[["5\n9\n99\n999\n99999\n999999","45\n615\n6570\n597600\n5689830"]],"created_at":"2026-03-03 11:09:25"}}