#P1700B. Palindromic Numbers

    ID: 7730 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>constructive algorithmsimplementationmath*1100

Palindromic Numbers

No submission language available for this problem.

Description

During a daily walk Alina noticed a long number written on the ground. Now Alina wants to find some positive number of same length without leading zeroes, such that the sum of these two numbers is a palindrome.

Recall that a number is called a palindrome, if it reads the same right to left and left to right. For example, numbers 121,66,98989121, 66, 98989 are palindromes, and 103,239,1241103, 239, 1241 are not palindromes.

Alina understands that a valid number always exist. Help her find one!

The first line of input data contains an integer tt (1t1001 \leq t \leq 100) — the number of test cases. Next, descriptions of tt test cases follow.

The first line of each test case contains a single integer nn (2n1000002 \leq n \leq 100\,000) — the length of the number that is written on the ground.

The second line of contains the positive nn-digit integer without leading zeroes — the number itself.

It is guaranteed that the sum of the values nn over all test cases does not exceed 100000100\,000.

For each of tt test cases print an answer — a positive nn-digit integer without leading zeros, such that the sum of the input integer and this number is a palindrome.

We can show that at least one number satisfying the constraints exists. If there are multiple solutions, you can output any of them.

Input

The first line of input data contains an integer tt (1t1001 \leq t \leq 100) — the number of test cases. Next, descriptions of tt test cases follow.

The first line of each test case contains a single integer nn (2n1000002 \leq n \leq 100\,000) — the length of the number that is written on the ground.

The second line of contains the positive nn-digit integer without leading zeroes — the number itself.

It is guaranteed that the sum of the values nn over all test cases does not exceed 100000100\,000.

Output

For each of tt test cases print an answer — a positive nn-digit integer without leading zeros, such that the sum of the input integer and this number is a palindrome.

We can show that at least one number satisfying the constraints exists. If there are multiple solutions, you can output any of them.

Samples

Sample Input 1

3
2
99
4
1023
3
385

Sample Output 1

32
8646
604

Note

In the first test case 99+32=13199 + 32 = 131 is a palindrome. Note that another answer is 1212, because 99+12=11199 + 12 = 111 is also a palindrome.

In the second test case 1023+8646=96691023 + 8646 = 9669.

In the third test case 385+604=989385 + 604 = 989.