e-olymp
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 coin.

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

The first line contains two integers a and b (1a, b109).

Output

The output file output the number of pies eaten Roma.

Time limit 0.1 seconds
Memory limit 8 MiB
Input example
Sample 1
1 2

Sample 2
2 2

Sample 3
5 4

Sample 4
10 5
Output example
Sample 1
1

Sample 2
2

Sample 3
1

Sample 4
5
Контакты