Anuj recently gave his maths test. The results are out and his marks are very poor. So, he has decided to sneak into professor's office and change his score. He now has only X seconds before professor is back. His score is represented by a very huge number.
He can increase/decrease a digit by 1 in one second. Digits can vary form 0 to 9, so if 9 is increased by 1, it'll become 0 and if 0 is decreased by 1, it'll become 9. In other words, digits are cyclic. He can inc/dec a digit multiple times.
In other words, he can do this operation at most X times and get the max score possible.
Help him find the maximum possible score that he could achieve.
Note: Score can have leading zeros.
Input Format:
First line contains T, number of test cases.
Each of the next T lines, contains N and X.
Output Format:
Print the required answer in separate lines for each test case.
Constraints:
1≤T≤10
1≤ number of digits(N) ≤105
1≤X≤105
For the first case, he can inc 3 to 4 and get max score as 4456.
For second case, he can decrease first digit 3 times, second digit 4 times and increase third digit 3 times to get 99756745.