Problem: You are given two binary strings and , which are binary representations of some two integers (let's denote these integers as and ). You can choose any integer , calculate the expression and write the binary representation of in reverse order (let's denote it as ). For example, let and ; you've chosen and, since , so and .
For given and , you need to choose such that is lexicographically minimal (read notes if you don't know what does "lexicographically" means).
It's guaranteed that, with given constraints, exists and is finite.
Input Format: The first line contains a single integer () — the number of queries.
Next lines contain a description of queries: two lines per query. The first line contains one binary string , consisting of no more than characters. Each character is either 0 or 1.
The second line contains one binary string , consisting of no more than characters. Each character is either 0 or 1.
It's guaranteed, that (where is the integer represented by , and is the integer represented by ), both representations don't have any leading zeroes, the total length of over all queries doesn't exceed , and the total length of over all queries doesn't exceed .
Output Format: Print integers (one per query). For each query print such that is lexicographically minimal.
Note: The first query was described in the legend.
In the second query, it's optimal to choose . The so and . For example, if , then and , but is lexicographically smaller than .
In the third query and . For example, and . And is lexicographically smaller than .
The quote from Wikipedia: "To determine which of two strings of characters comes when arranging in lexicographical order, their first letters are compared. If they differ, then the string whose first letter comes earlier in the alphabet comes before the other string. If the first letters are the same, then the second letters are compared, and so on. If a position is reached where one string has no more letters to compare while the other does, then the first (shorter) string is deemed to come first in alphabetical order."