# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Poltu gives another interesting problem to his friend Boltu. The description is given below-

You are given two integer **L** and **R**. You have to find the summation of digit product of all number from **L** to **R**(inclusive).

Example of digit product:

The digit product of **154** = **1** × **5** × **4** = **20**.

The digit product of **1214** = **1** × **2** × **1** × **4** = **8**.

The first line contains an integer **T**(**1** ≤ **T** ≤ **100**), number of test cases.

Next T lines contain two integer **L** and **R**(**1** ≤ **L** ≤ **R** ≤ **10**^{1000}).

For each test case print the case number and result **MOD** (**10**^{9} + **7**).

Input | Output |
---|---|

2 12 14 8 10 | Case 1: 9 Case 2: 17 |

Login to submit

This is a DP problem. You can solve this problem with Digit DP. If you don't know about Digit DP...