Task
Tommaso would like to buy a new computer but unfortunately he doesn't have enough money. So he decided to try his luck and buy some lottery tickets.
The lottery tickets are numbered, and one of his friends told him the secret to win the lottery: in a winning ticket the sum of the digits of the ticket number is exactly and the ticket number does not contain consecutive equal digits.
When Tommaso arrived to the lottery shop, he saw that some tickets were already sold. The current ticket number is and Tommaso must buy the tickets in order (first ticket number , then ticket number , then ticket number , and so on).
He wants to buy some tickets until he finds a winning one. Note that it is possible that Tommaso is not able to buy a winning ticket.
What is the number of the winning ticket bought by Tommaso?
Help Tommaso to find the answer in different scenarios.
Input
The first line contains a single integer (), denoting the number of test cases.
The following lines contains integers: and (), ().
For tests worth points, and the length of each does not exceed .
For tests worth more points, and the length of each does not exceed .
Output
You need to write lines with an integer: the number of the winning ticket bought by Tommaso, or if he can not buy one.
Example 1
stdin
4
7 502
1 123
10 99
16 4440
stdout
502
-1
109
4453
Explanation
In the first sample case:
In the first test Tommaso can buy the first ticket since it is a winning ticket.
In the second test case Tommaso can not buy any winning ticket. Note that the ticket number is not a winning ticket since it contains three consecutive .