설명
\(4^{th}\) round, February \(18^{th}\), 2012
Find the \(N\)-th smallest positive integer whose least prime factor is P, or state that the result is greater
than \(10^{9}\).
제약
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.
입력 형식
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 a single line with the expected result, or zero if result exceeds \(10^{9}\).
예제 1
입력
1 2출력
2예제 2
입력
2 3출력
9예제 3
입력
1000 1000003출력
0문제 정보