#P9640. Sum of Mode of Digits

    ID: 22787 Type: Default 1000ms 256MiB

Sum of Mode of Digits

Sum of Mode of Digits

Let \(m(x)\) be the mode of the digits in the decimal representation of a positive integer \(x\). The mode is defined as the largest digit that appears most frequently in the number. For example, \(m(15532)=5\), \(m(25252)=2\), \(m(103000)=0\), \(m(364364)=6\), \(m(114514)=1\), and \(m(889464)=8\).

Given a positive integer \(n\), compute \[ \left(\sum_{x=1}^{n} m(x)\right) \bmod (10^9+7)\] and output the result.

inputFormat

The input consists of a single line containing a positive integer \(n\).

outputFormat

Output a single integer which is the value of \(\left(\sum_{x=1}^{n} m(x)\right) \bmod (10^9+7)\).

sample

1
1