eolymp
bolt
Try our new interface for solving problems
Problems

Cake from Tolya

Cake from Tolya

\includegraphics{https://static.e-olymp.com/content/95/95f551fa1ebf2cb6e1eb104418d2215e13b5a781.gif} Tolya is planning to treat his friends to a cake on his birthday. It is known that there can be either $n$ or $m$ people at the birthday party, including Tolya himself. What is the minimum number of slices he needs to cut the cake into (not necessarily equal slices) so that, regardless of the number of guests, everyone can have an equal portion of cake? \InputFile Two integers $m$ and $n\:(1 \le m, n \le 30000)$. \OutputFile Print the minimum number of cake slices.
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