Integers and Ranges
Time limit3sMemory limit512 MB
Count the digit strings of length n where the product of digits in every given range is divisible by 9, modulo 1e9+7.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Intervals, Number theory
- Solved
- No attempts yet
Problem
Time limit: 3000 ms. Memory limit: 512 MB.
Isaac has a decimal integer , possibly with leading zeroes. He knows that for ranges , the product holds for each range . Find the number of valid integers , modulo .
Input
The input consists of several test cases and ends at end-of-file.
The first line of each test case contains two integers and . The next lines each contain two integers and .
Output
For each test case, print one integer, the result.
Constraints
- There are at most test cases.