A palindrome number is a number that can be read the same way from left to right and from right to left. For example: 961169, 111, 554455 are palindromes, while 856, 10180, 7226 are not.
Find the largest palindrome number that satisfies the following rules:
If there is no such number print - 1.
The first line of the input contains an integer T (1 ≤ T ≤ 500), where T is the number of the test cases.
Each test case has one line that contains two integers n (1 ≤ n ≤ 106) number of digits, and s (1 ≤ s ≤ 9 × 106) sum of digits.
For each test case, print a single integer that represents the largest palindrome number that satisfies the mentioned rules, if there is no such number print - 1.
2
2 2
4 26
11
9449
Name |
---|