BROJ
시간 제한: 1000ms메모리 제한: 128MB출처: COCI 2011-2012BOJ 2814
문제
Find the N-th smallest positive integer whose least prime factor is P, or state that the result is greater than 109.
입력
The first and only line of input contains space seperated integers N and P (1 ≤ N, P ≤ 109). P will always be prime.
출력
Output a single line with the expected result, or zero if result exceeds 109.
예제
예제 1
입력
1 2
출력
2
예제 2
입력
2 3
출력
9
예제 3
입력
1000 1000003
출력
0
코드를 제출하려면 로그인하세요.