The equality#1010

The equality

1 second
64 megabytes
Easy

Returning home from school, Peter each time pays attention to the inscription on the fence "1 + 1 = 10" and is obviously amazed that it is 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 his own three numbers so that the sum of the first two is equal to the third in some number system.

Now, he enumerates three numbers, which, in his view, deserve to be on the fence. Peter chooses the numbers , , , written in decimal digits, and attempts to find the radix , in which the equality A + B = C is correct. Peter considers systems with bases from to infinity.

Since checking each triple is a time-consuming exercise, to help Pete you should write a program that facilitates the calculations.

Input

The first line contains the number , consisting of digits from to , with a length of no more than . The next two lines, in the same format, record the numbers and . All numbers are nonnegative and without leading zeros.

Output

Output the minimum radix in which the equality A + B = C holds. If such a radix does not exist, then output .

Examples

Example 1

Loading
Loading