During a scientific experiment, Nakodilla accidentally received an alien message containing a formula in the form:
A + B = C.
The public was curious about which numeral system the aliens used. Since the extraterrestrial civilization was developed enough to send an interstellar message, Nakodilla hypothesized that the base of the numeral system might be small. You are required to find the smallest base for which this equality holds.
The input consists of a single line containing an equation in the form A+B=C. The string contains no spaces. Each number is represented by no more than characters, using digits and uppercase Latin letters.
Output a single integer — the smallest base for which the equality holds. If such a base does not exist, output . It is guaranteed that the answer does not exceed .
Example 1