Nour likes comic books so much that she decided to write her own comic book. Once she had this amazing idea, she started working on it immediately.
After a few days she finished her very first comic book. Since Nour is a workaholic, she wrote a huge comic book during these days with a lot of pages. Since Nour likes to be special in everything she started numbering her comic book from number X. In other words the first page has number X written on it, the second page has number X + 1 written on it, and so on.
Like we all know, Nour enjoys giving her friend Ahmed a hard time. That's why one day on their way to work, she asked her friend Ahmed the following question:
"Say Ahmed, can you guess the number of pages of my new comic book? I used a total number of digits equal to N, and started numbering my comic book from the number X, or say that such a thing is impossible. Since you are only an experimental physicist I'll give you an example: the number 99 has 2 digits on it. So if I wrote only 2 pages starting from the number 99, I would have used 5 digits to number my comic book".
Ahmed is so busy driving, and also he is really holding his nerves not to throw Nour out of the window right now. So he turned to you to help him solve this idiotic question from his annoying friend.
The first line contains an integer T, the number of test cases.
Each line of the following T lines describes a single test case. Each test case contains 2 space separated integers N, X (1 ≤ N, X ≤ 1015).
For each test case print a single line, containing a single integer, denoting the number of pages in Nour's comic book, or print -1 if such a thing is impossible.
## Input
The first line contains an integer T, the number of test cases.Each line of the following T lines describes a single test case. Each test case contains 2 space separated integers N, X (1 ≤ N, X ≤ 1015).
## Output
For each test case print a single line, containing a single integer, denoting the number of pages in Nour's comic book, or print -1 if such a thing is impossible.
[samples]
**Definitions**
Let $ P = \{k, M, G, T, P, E, Z, Y\} $ be the set of 8 prefixes, corresponding to powers $ 10^3, 10^6, 10^9, 10^{12}, 10^{15}, 10^{18}, 10^{21}, 10^{24} $ respectively.
Let $ N \in \mathbb{Z} $ be such that $ N \equiv 0 \pmod{3} $ and $ 3 \leq N < 10^6 $.
Let $ m = N / 3 $, the total number of 3-power units needed to represent $ 10^N $.
**Constraints**
1. $ 1 \leq T \leq 10^5 $
2. For each test case, $ N \equiv 0 \pmod{3} $, $ 3 \leq N < 10^6 $, and $ m = N/3 \in \{1, 2, \dots, 333333\} $
3. Only the 8 prefixes above may be used; each contributes exactly 3 to the exponent.
**Objective**
For each $ N $, compute the number of ordered sequences (compositions) of length $ \geq 1 $, using elements from $ \{1, 2, 3, 4, 5, 6, 7, 8\} $ (representing the 8 prefixes, each contributing 1 unit of exponent 3), such that the sum of the sequence equals $ m $.
This is equivalent to the number of compositions of $ m $ into exactly $ m $ parts, where each part is an integer in $ \{1, 2, \dots, 8\} $.
Let $ a_m $ denote the number of such compositions. Then:
$$
a_0 = 1, \quad a_m = \sum_{i=1}^{\min(8,m)} a_{m-i} \quad \text{for } m \geq 1
$$
Output $ a_m \mod (10^9 + 7) $.