시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 170 20 19 14.961%

## 문제

가장 작은 소인수가 P인 숫자 중에서 N번째 작은 수를 구하는 프로그램을 작성하시오.

## 입력

첫째 줄에 N과 P가 주어진다. (1 ≤ N, P ≤ 109) P는 항상 소수이다.

## 출력

첫째 줄에 가장 작은 소인수가 P인 숫자 중 N번째로 작은 수를 출력한다. 만약, 그러한 수가 109를 넘을 경우에는 0을 출력한다.

## 예제 입력 1

2 3


## 예제 출력 1

9

W3sicHJvYmxlbV9pZCI6IjI4MTQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWNkNWNcdWMxOGNcdWM3NzhcdWMyMTgiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YWMwMFx1YzdhNSBcdWM3OTFcdWM3NDAgXHVjMThjXHVjNzc4XHVjMjE4XHVhYzAwIFBcdWM3NzggXHVjMjJiXHVjNzkwIFx1YzkxMVx1YzVkMFx1YzExYyBOXHViYzg4XHVjOWY4IFx1Yzc5MVx1Yzc0MCBcdWMyMThcdWI5N2MgXHVhZDZjXHVkNTU4XHViMjk0IFx1ZDUwNFx1Yjg1Y1x1YWRmOFx1YjdhOFx1Yzc0NCBcdWM3OTFcdWMxMzFcdWQ1NThcdWMyZGNcdWM2MjQuPFwvcD5cclxuIiwiaW5wdXQiOiI8cD5cdWNjYWJcdWM5ZjggXHVjOTA0XHVjNWQwIE5cdWFjZmMgUFx1YWMwMCBcdWM4ZmNcdWM1YjRcdWM5YzRcdWIyZTQuICgxICZsZTsgTiwgUCAmbGU7IDEwPHN1cD45PFwvc3VwPikgUFx1YjI5NCBcdWQ1NmRcdWMwYzEgXHVjMThjXHVjMjE4XHVjNzc0XHViMmU0LjxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPlx1Y2NhYlx1YzlmOCBcdWM5MDRcdWM1ZDAgXHVhYzAwXHVjN2E1IFx1Yzc5MVx1Yzc0MCBcdWMxOGNcdWM3NzhcdWMyMTh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