eolymp
Competitions

Азербайджан - подготовка. Март 10

Cake from Tolya

prb398 On his birthday Tolya wants to regale his friends with cake. It is known that at the birthday party can be either n, or m people, including Tolya. What is the minimum number of parts the cake must be cut (not necessarily all equal), so that for either n or m guests, all can eat the cake evenly?

Input

Two integers m and n (1m, n30000).

Output

Print the minimum number of cake pieces.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2 3
Output example #1
4

Example description: The cake should be cut into pieces 1/3, 1/3, 1/6 and 1/6. Then, for 2 holiday parties each eat 1/3 + 1/6, and at 3-one eats, respectively: 1/3, 1/3, 1/6 + 1/6 = 1/3