题目描述
Problem Description
kaisei705 was about to go to a convenience store with \( N \) yen in the decimal system.
However, due to fatigue or bad luck, he was hit by a truck and unexpectedly reincarnated into a parallel world.
According to the god, each world is numbered, and in the world numbered \( M \), the \( M \)-ary system is used.
It seems that the amount of money he has after reincarnation is \( X \) yen in the representation of the world he reincarnated into.
kaisei705: "Please, send me back to my original world!"
God: "I'll think about it if you can figure out the number of this world."
kaisei705: "I don't know..."
Given the integer \( N \) and the string \( X \), please find the number \( M \) of the world he reincarnated into on his behalf.
Note that the amount of money remains unchanged before and after reincarnation.
Input Format
The input is given from the standard input in the following format:
\( N \) \( X \)
Output Format
Output the answer \( M \) in one line.
Sample Input and Output
Sample Input #1
334 334
Sample Output #1
10
Sample Input #2
5191491411 46533757523
Sample Output #2
8
Notes/Hints
Constraints
- \( N \) is an integer.
- \( 9 \leq N \leq 10^{18} \)
- \( 1 \leq |X| \leq 60 \)
- The answer \( M \) is an integer between 2 and 10 inclusive, and it is guaranteed to be uniquely determined under the constraints of this problem.
Sample Explanation 1
It seems that the world he reincarnated into also used the decimal system. Did he really reincarnate?
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分