2020 Цикл Интернет-олимпиад для школьников, первая командная олимпиада, 18 октября

Important scientific number

Time limit 1 second
Memory limit 128 MiB

Pin was assembling his very important new invention, but at some point he discovered that he had made a mistake in one of the formulas and could have assembled the corresponding part incorrectly.

After carefully looking at the detail and correcting the formula, Pin noted that now the part contains two gears with a and b teeth, respectively, and it will work correctly with gears of sizes a + x and b + x respectively, where x is a non-negative integer such that a + x is divisible by b and b + x is divisible by a.

Pin is very tired, so he asks you to help him find such a non-negative x that satisfies the given conditions. Because Pin doesn't like big gears, the minimum of all possible x values should be chosen.

Input data

One line contains two numbers a and b (1a, b10^9) - the sizes of the gears in the detail.

Output data

Print one non-negative integer x - the minimum number of teeth missing in the gears for the invention to work correctly.


Input example #2
8 1
Output example #2
Input example #3
3 4
Output example #3
Input example #4
123 123
Output example #4
Source 2020 Cycle of Internet Olympiads for schoolchildren, First team contest, October 18, Problem А