#B4025. Compute Greatest Common Divisor

    ID: 11682 Type: Default 1000ms 256MiB

Compute Greatest Common Divisor

Compute Greatest Common Divisor

Given two positive integers a and b, compute their greatest common divisor, denoted as \(\gcd(a,b)\). The \(\gcd(a,b)\) is defined as the largest positive integer \(d\) such that \(d\) divides both a and b.

For example, \(\gcd(9,12)=3\) because both 9 and 12 are divisible by 3 and no greater integer divides them both.

inputFormat

Input consists of two space-separated positive integers, a and b.

outputFormat

Output the greatest common divisor of a and b.

sample

9 12
3