1513C.md (1390B)
1 Source: https://codeforces.com/problemset/problem/1513/C 2 3 C. Add One 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given an integer $n$. You have to apply $m$ operations to it. 22 23 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. 24 25 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$. 26 27 Input 28 29 The first line contains a single integer $t$ ($1 \le t \le 2 \cdot 10^5$) — the number of test cases. 30 31 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. 32 33 Output 34 35 For each test case output the length of the resulting number modulo $10^9+7$. 36 37 Example 38 39 Input 40 41 ``` 42 5 43 1912 1 44 5 6 45 999 1 46 88 2 47 12 100 48 ``` 49 50 Output 51 52 ``` 53 5 54 2 55 6 56 4 57 2115 58 ``` 59 60 Note 61 62 For the first test, $1912$ becomes $21023$ after $1$ operation which is of length $5$. 63 64 For the second test, $5$ becomes $21$ after $6$ operations which is of length $2$. 65 66 For the third test, $999$ becomes $101010$ after $1$ operation which is of length $6$. 67 68 For the fourth test, $88$ becomes $1010$ after $2$ operations which is of length $4$.