Problems
The aliens
The aliens
During Science Experiment Nakodilly accidentally received a message of aliens, which contains a formula of the form
\textbf{A + B = C}.
The public began to wonder what the same notation used by aliens. Since the extraterrestrial civilization was developed enough to send an interstellar message Nakodilla suggested that the radix quite a bit. Required to write a program that finds the minimum radix at which this equality holds.
\InputFile
In a single line of input data is the equation of the form \textbf{A+B=C}. The string does not contain spaces, and the numbers are composed of capital letters and numbers and do not contain more than \textbf{5} characters.
\OutputFile
You want to display a single number - the desired radix. If such a number system does not exist, then output \textbf{-1}. It is guaranteed that the answer does not exceed \textbf{36}.
Input example #1
2+2=4
Output example #1
5