eolymp
bolt
Try our new interface for solving problems
Problems

Treasure Hunter

Treasure Hunter

Young treasure hunter Roma took a course in the specialty "pantry thing" and now runs a summer practice. Summer practice is near the village of "Dawn Stone" and lasts exactly b days. Every day the novel is a coin buried in the vicinity. Thus, at the end of the first day, he had a coin at the end of the second 2 * a, and at the end of practice at the Roma must be accumulated b * a coins.

If at the end of the day the responsible teacher noticed that the number is divisible by Romas coins b, the Roma were allowed to take off the shelf cake, which he immediately ate. Romas help calculate how many pies he eats during an internship.

Input

Two integers a and b (1a, b109).

Output

Print the number of pies eaten by Roma.

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