Divide by Zero 2021 and Codeforces Round 714 (Div. 2)
C
Add One
Codeforces
1600
原题
← BD →
翻译中…

You are given an integer $n$. You have to apply $m$ operations to it.

翻译中…

In a single operation, you must replace every digit $d$ of the number with the decimal representation of integer $d + 1$. For example, $1912$ becomes $21023$ after applying the operation once.

翻译中…

You have to find the length of $n$ after applying $m$ operations. Since the answer can be very large, print it modulo $10^9+7$.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 2 \cdot 10^5$) — the number of test cases.

翻译中…

The only line of each test case contains two integers $n$ ($1 \le n \le 10^9$) and $m$ ($1 \le m \le 2 \cdot 10^5$) — the initial number and the number of operations.

翻译中…

Output

翻译中…

For each test case output the length of the resulting number modulo $10^9+7$.

翻译中…

Note

翻译中…

For the first test, $1912$ becomes $21023$ after $1$ operation which is of length $5$.

翻译中…

For the second test, $5$ becomes $21$ after $6$ operations which is of length $2$.

翻译中…

For the third test, $999$ becomes $101010$ after $1$ operation which is of length $6$.

翻译中…

For the fourth test, $88$ becomes $1010$ after $2$ operations which is of length $4$.

翻译中…

样例

Input #1
5
1912 1
5 6
999 1
88 2
12 100
Output #1
5
2
6
4
2115
InputCopy OutputCopy
题目信息
题号
1513C
时间限制
1 s
内存限制
256 MB
标签
动态规划
矩阵

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。