eolymp
bolt
Try our new interface for solving problems

A + B

\textit{Not a set of} \includegraphics{https://static.e-olymp.com/content/49/49270e28ebc371c9e6e548fe5edf6353526f0ecb.jpg} \textit{from a letter to the }\textit{\textbf{i}} When a famous algebraist (hereinafter - O.I.A.) with fur-mate was a kid, he was at school was strictly forbidden to take the square roots of negative numbers. Of course, O.I.A. ban on spat and even (oh, horror!) began to use what you get after taking a root, as the radix. \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} Recently O.I.A. found my old records, and in them some sort of suspicious identity. To check it spravdelivost, O.I.A. enough to add two numbers and see the result. Unfortunately, these two numbers are written just as a number system with base equal to the square root of negative numbers (specifically, ), and the answer must also be represented in the radix . Your task - to help O.I.A. verify identity, adding two numbers. \includegraphics{https://static.e-olymp.com/content/91/91b6d4e964d343450eb9c9e870458c65f7c164e6.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} As you know, \textit{imaginary numbers} - these are the numbers that are the result of taking the square root of negative numbers. In a \textit{system with an imaginary base} in the numbers using the numbers from \textbf{0} to \textbf{k-1}, inclusive. Imaginary radix behave exactly the same as usual, that is, the number written as \textbf{d_3d_2d_1d_0}, is given by \textbf{d_3·b^3+d_2·b^2+d_1·b+d_0}, where \textbf{b} - the radix (in this problem, it is equal ). Thus, the number may be obtained form \textbf{x+y}, where \textbf{x} and \textbf{y} - are any integers. For example: 1030003_=1·()^6+3·()^4+3·()^0=-64+3·16+3=-13. \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} Despite the fact that the operation of taking roots of negative numbers is ambiguous (as , and - make a square \textbf{-4}), as the radix is ​​always taken the same number. \InputFile \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} The first line number is set to \textbf{A}, the second - the number of \textbf{B}. Their length does not exceed \textbf{1000000}. The numbers given in the radix and does not contain leading zeros, the number of 0 represents a zero. \OutputFile \includegraphics{https://static.e-olymp.com/content/60/608e4158c7825665af50de0aa3b0146957509655.jpg} The only line of output file to be printed the number of \textbf{A+B}, written in radix . The displayed number should not contain leading zeros, the number \textbf{0} shall be indicated by one zero.
Time limit 2 seconds
Memory limit 256 MiB
Input example #1
2
3
Output example #1
10301