eolymp
bolt
Try our new interface for solving problems
Problems

Cleaning the territory

Cleaning the territory

In the school yard the builders left two mountains of sand, and their volume is known - n and m liters. Janitor Uncle Peter wanted to arrange the cleaning in the school yard, but for this he needs a bucket to take away the sand from the territory. Uncle Peter want to take the largest bucket, so that to carry out both the first and the second pile of sand he needs to bring a certain number of fully filled buckets. Moreover, Uncle Peter is planning to do on Monday the first mountain, and the second mountain only on Wednesday. So he will move out the sand from each pile separately and independently from each other.

You need to find the capacity (in liters) of such bucket so that Uncle Peter made a minimum number of buckets and completely cleaned the yard.

Input

In one line two numbers are given: n and m (0 < n, m216).

Output

Print one number - the answer to the problem.

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