eolymp
bolt
Try our new interface for solving problems
Problems

Сalculation

Сalculation

Vasily Pupkin, a permanent member NetOI, was awarded a trip to the country of Olympia. But all we need money. Sponsors listed certain sum to his account in the correct currency, saying, of course, this amount Vasily. When he came to Olympia in the bank to get money, the amount of documents was different at first glance is much greater. Basil was very happy. But after talking with the bank officer knew - was groundless joy, more money was gone, just in Olympia used a different (well, at least positional!) Number system. Having a good mathematical training, Vasily immediately found the base system, which is used in Olympia. Do this and you.

Input

Two integers - one in the decimal system, and another - in a system with base n (2n < 10). Each of the numbers being entered contains at least 2 and not more than 18 digits.

Output

Print the base n of numeral system. It is guaranteed that a solution exists.

Time limit 1 second
Memory limit 64 MiB
Input example #1
14 1110
Output example #1
2
Input example #2
31 111
Output example #2
5