#K71962. Greatest Common Divisor Calculation

    ID: 33648 Type: Default 1000ms 256MiB

Greatest Common Divisor Calculation

Greatest Common Divisor Calculation

Given two integers a and b, your task is to compute their Greatest Common Divisor (gcd). The greatest common divisor of two integers is the largest positive integer that divides both numbers without leaving a remainder. The gcd can be computed efficiently using the Euclidean algorithm which is based on the following formulas:

$$\gcd(a,0)=a$$

$$\gcd(a,b)=\gcd(b, a \bmod b)$$

Implement the algorithm to read two integers from standard input and output their gcd to standard output.

inputFormat

The input consists of a single line containing two space-separated integers a and b.

outputFormat

Output a single integer representing the greatest common divisor of a and b.

## sample
48 18
6