The equality
Returning home from school, Peter each time paying attention to the inscription on the fence "1 + 1 = 10" and marveled obvious he was wrong. But once he realized that this equality is true if we consider it in the binary system. He was so struck by this idea that he decided to definitely come up with their three numbers so that the sum of the first two was equal third in a system of notation.
Now, he enumerates three numbers, which, in his view, deserve to be on the fence. Peter chooses the number of A, B, C, written to decimal digits, and further attempts to find the radix K, in which the equality of A + B = C proved to be correct. Peter considers the system with base from 2 to infinity.
Since each triple check - a time-consuming exercise, to help Pete should write a program that facilitates the calculations.
Now, he enumerates three numbers, which, in his view, deserve to be on the fence. Peter chooses the number of A, B, C, written to decimal digits, and further attempts to find the radix K, in which the equality of A + B = C proved to be correct. Peter considers the system with base from 2 to infinity.
Input
The first line contains the number of A, consisting of numbers from 0 to 9 lengths not more than 200. In the following two lines in the same format recorded in the number of B and C. All numbers are nonnegative and without leading zeros.
Output
Derive the minimum radix, in which the equality A + B = C. If that does not exist, then bring up to 0.
Derive the minimum radix, in which the equality A + B = C. If that does not exist, then bring up to 0.