#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 ,which means the carries of integer plus integer is , and the answer of integer plus integer is . All the and is missing while all the and is known, your task is to help Peach find the minimum suitable positive integer .
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.
Input
The first line contains an integer , which means the number of problems on Orange's exercise book.
For each line contains two integers , which means above.
Output
For each problem, output one integer representing the answer in one line. If there is no solution, output 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 , and it's easy to see that is the minimum suitable positive integer.
Resources
2023暑期前集训第一次队内赛