Solution of the machine equation
In one of the early machines designed by McCulloch, there were only two rules for generating a number from a given one, using the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and determining the admissibility of numbers:
For any number X (which can even be empty), the number 2X (where N M denotes the concatenation of numbers N and M) is considered admissible, and 2X generates the number X.
For any admissible number X, the number 3X is also admissible. Furthermore, if the number X generates the number Y, then 3X generates the associate of Y, which is the number Y 2Y.
McCulloch often challenged Inspector Craig with puzzles involving this machine. In these puzzles, two expressions S_1(X) and S_2(X) were provided, each potentially containing parts of X as a substring. The task was to find a value of X such that S_1(X) is an admissible number, which when processed by the machine, generates the number S_2(X). The inspector seeks your assistance in writing a program to find the desired number X.
Input
The first line of the input file specifies the expression S_1(X), which, after substituting X, will be input into the machine. The second line specifies the expression S_2(X), which needs to be produced as output. The first line contains no more than 25 characters, and the second line no more than 100 characters, each of which is either a decimal digit or the letter X.
Output
On the first line of the output file, print Unique if there is a single solution, Multiple if there are multiple solutions, and No solution if no solutions exist. If solutions exist, on the second line, print any value of X that satisfies the problem condition.