Decimal digits can be formed using matchsticks as shown below. Each dark segment represents one matchstick. The digits $$$0,1,2,3,4,5,6,7,8,9$$$ require $$$6,2,5,5,4,5,6,3,7,6$$$ matchsticks, respectively.
Figure: Matchstick representations of decimal digits
For a positive integer $$$x$$$, let $$$g(x)$$$ be the total number of matchsticks needed to form its decimal representation without leading zeros. Starting with the given positive integer $$$x$$$, perform the assignment $$$x=g(x)$$$ exactly $$$10$$$ times, and denote the final value of $$$x$$$ by $$$f(x)$$$.
Given positive integers $$$a$$$ and $$$b$$$, find
$$$$$$\sum_{x=a}^{b} f(x) \bmod (10^9+7)$$$$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$T$$$ ($$$1 \le T \le 1000$$$). Description of the test cases follows.
The first line contains a positive integer $$$a$$$ ($$$1 \le a \lt 10^{1000}$$$), without leading zeros.
The second line contains a positive integer $$$b$$$ ($$$a \le b \lt 10^{1000}$$$), without leading zeros.
The sum of the lengths of the decimal representations of $$$a$$$ and $$$b$$$ over all test cases does not exceed $$$2000$$$.
For each test case, output one line containing the answer.
Print the required sum modulo $$$10^9 + 7$$$.
2110137284
51758
For the first test case:
For $$$x=1,2,3,5,7,8,10$$$, we have $$$f(x)=5$$$; for $$$x=4$$$, we have $$$f(x)=4$$$; and for $$$x=6,9$$$, we have $$$f(x)=6$$$. Thus the answer for this test case is $$$7\cdot5+4+2\cdot6=51$$$.