#P5842. [SCOI2012] Blinker 的仰慕者
[SCOI2012] Blinker 的仰慕者
Problem Description
Blinker has many admirers, and he gives each admirer a positive integer ID. These IDs also hide a special meaning: the product of the digits of an ID represents how important this admirer is to Blinker. Now Blinker wants to know the sum of all admirer IDs between two values and , whose importance equals a fixed value .
Input Format
The first line contains an integer , which represents the number of queries Blinker wants to ask.
The next lines each contain three numbers , , and , meaning Blinker wants the sum of all admirer IDs between and whose importance is .
Output Format
Output lines. For each query, output the sum of all admirer IDs between and whose importance is . Since the result may be very large, take it modulo .
3
1 14 4
1 30 4
10 60 5
18
40
66
Hint
Constraints
- For of the testdata: , .
- For of the testdata: , .
- For of the testdata: , .
Translated by ChatGPT 5