A certain natural number is hidden. Three statements have been made about it:
You need to determine what is the smallest natural number that could have been hidden (or if such a number does not exist). You need to find the answer for several test cases.
The first line of the input contains an integer $$$T$$$ — the number of test cases ($$$1 \le T \le 1000$$$).
In each of the following $$$T$$$ lines, five integers $$$A$$$, $$$B$$$, $$$C$$$, $$$D$$$, $$$E$$$ are given, separated by spaces ($$$0 \le A, B, C, D, E \le 10^9$$$).
For each test case, output the smallest natural number that could have been hidden. If such numbers do not exist, output -1.
Solutions that work for $$$T=1$$$ and $$$A, B, C, D, E \le 100$$$ will be scored 40 points.
25 8 4 10 37 8 7 3 9
5 -1
Note for participants writing in Python. You can read 5 numbers entered with spaces like this:
a, b, c, d, e = map(int, input().split())
| Name |
|---|


