| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 | 1024 MB | 158 | 35 | 30 | 21.127% |
\textit{In this problem, you have to find the next integer in a particular ordering with has the same set of prime divisors.}
Archaeologist Kris studies the ancient platform Flex which was recently found near Adobe creek. On this platform, the numbers of different versions of teleporters which have been created by The Elders were once inscribed. Each version number is an integer between 1ドル$ and $N$. On the platform, there are several columns of numbers, one for each teleporter. Each column once listed all created versions of a teleporter in the order they were built. Unfortunately, some of the numbers were erased.
Kris just finished studying version $a$ of teleporter $b,ドル and he is now ready to examine the next version of this teleporter. But he does not even know its number! On the other hand, any program which is a correct solution of this problem must know it. Below is what Kris already knows about the version numbers of the teleporters:
The only line of input contains two integers --- the version number $a$ of a teleporter and the number $N$ (1ドル \le a \le N \le 10^{18}$).
If there exists a version of the same teleporter which was built just after version $a,ドル print its number. Otherwise, print "-1".
6 13
12
12 13
-1