#Lutece2966. Orange Loves Addition

Orange Loves Addition

Migrated from Lutece 2966 Orange Loves Addition

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Recently, little Orange has learned the integer addition, and she finished her homework quickly. But naughty Peach accidentally poured his drink on her exercise book and some of the numbers were blurred. Orange is crying sadly, and Peach want to make a new copy for her to get forgiveness. But the exercise book is damaged so badly that it's very hard to find out the original blurred numbers. So Peach want to get the minimum suitable positive integer to fix these. However, he don't know how to do that so he turns to you for help.

Formally, the problems on the exercise book can be all described as x+y=z:(c)x+y=z:(c),which means the carries of integer xx plus integer yy is cc, and the answer of integer xx plus integer yy is zz . All the yy and zz is missing while all the xx and cc is known, your task is to help Peach find the minimum suitable positive integer yy.

We adds numbers by column addition in base-ten, just like what we normally do in primary school. For example, there are two carries in the following addition.

image-20230420120943389.png

Input

The first line contains an integer n (1n105)n\ (1\leq n\leq 10^5), which means the number of problems on Orange's exercise book.

For each line contains two integers x,c (1x109,0c9)x,c\ (1\leq x\leq 10^9, 0\leq c\leq 9), which means above.

Output

For each problem, output one integer representing the answer yy in one line. If there is no solution, output 1−1 instead.

Samples

4
114514 2
1919810 5
12345678 0
9 2
86
80190
1
91

Note

For the first problem in the example, we can calculate the two carries that 4+610, 1+8+1104+6\geq10,\ 1+8+1\geq 10, and it's easy to see that 8686 is the minimum suitable positive integer.

Resources

2023暑期前集训第一次队内赛