#B3736. Greatest Common Divisor of Three Numbers

    ID: 11395 Type: Default 1000ms 256MiB

Greatest Common Divisor of Three Numbers

Greatest Common Divisor of Three Numbers

Given three positive integers \(x\), \(y\), and \(z\), compute their greatest common divisor (GCD) \(g\). The greatest common divisor is defined as the largest positive integer \(g \geq 1\) such that \(x \bmod g = y \bmod g = z \bmod g = 0\).

inputFormat

The input consists of a single line containing three space-separated positive integers \(x\), \(y\), and \(z\).

outputFormat

Output the greatest common divisor of the three given numbers.

sample

8 12 16
4