4. Robot Charging
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A robot with the code name MAGD has type $$$n$$$. To recharge, it requires a device with power $$$p$$$, satisfying the conditions:

$$$ p \ge n + 1 $$$ (otherwise, the robot will not have enough power to recharge)

$$$ p \le n + k $$$ (otherwise, the robot may burn out)

Among all suitable powers $$$p$$$, we need to choose the one for which LCM($$$n$$$, $$$p$$$) is minimized, so that the robot's battery lasts as long as possible. Given $$$n$$$ and $$$k$$$, we need to compute $$$p$$$.

LCM($$$a$$$,$$$b$$$) is the least common multiple of the numbers $$$a$$$ and $$$b$$$, that is, the smallest natural number that is divisible by both $$$a$$$ and $$$b$$$.

Input

Two numbers $$$n$$$ and $$$k$$$ are given, each on a separate line ($$$1 \le n \le 10^{12}$$$, $$$ 1 \le k \le 10^{12}$$$)

Output

You need to output the number $$$p$$$ — the required power of the device.

Scoring

Each test is evaluated independently. The tests are divided into groups corresponding to the following subtasks:

SubtaskAdditional ConditionsPoints
$$$1$$$$$$n \le 100, k \le 100$$$up to 15
$$$2$$$$$$n \le 10^5, k \le 10^5$$$up to 15
$$$3$$$$$$n \le 5 \cdot 10^7$$$up to 30
$$$4$$$up to 40
Examples
Input
6
4
Output
9
Input
10
12
Output
20
Note

Note that the input data and the answer may exceed the range of possible values for a 32-bit integer variable, so it is necessary to use a 64-bit integer data type (type int64 in Pascal, type long long in C++, type long in Java and C#). In Python, no additional actions are required.