Find the $N$-th smallest positive integer whose least prime factor is P, or state that the result is greater than $10^{9}$.
Input
The first and only line of input contains space seperated integers N and P ($1 \le N$, $P \le 10^{9}$). P will always be prime.
Output
Output a single line with the expected result, or zero if result exceeds $10^{9}$.
Constraints
In test cases worth 30% of total points, expected result will either be less than 100 000, or will exceed $10^{9}$. In test cases worth additional 30% of total points, P will be greater than 1000.
Example 1
Input
1 2
Output
2
Example 2
Input
2 3
Output
9
Example 3
Input
1000 1000003
Output
0
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.