#P9651. Digit Product Modulo Multiplication

    ID: 22798 Type: Default 1000ms 256MiB

Digit Product Modulo Multiplication

Digit Product Modulo Multiplication

Define the digit product \(f(x)\) of a positive integer \(x\) as the product of all its digits. For instance, \(f(1234)=1\times2\times3\times4=24\) and \(f(100)=1\times0\times0=0\).

Given two integers \(l\) and \(r\), compute the following value:

\(\left(\prod_{i=l}^{r} f(i)\right) \mod (10^9+7)\)

If the \(\prod\) symbol is unfamiliar, understand it as the product of the sequence \(f(l) \times f(l+1) \times \cdots \times f(r)\).

inputFormat

The input consists of a single line containing two space-separated integers (l) and (r) representing the range.

outputFormat

Output a single integer: the product of the digit products for all numbers from (l) to (r), taken modulo (10^9+7).

sample

1 10
0