Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-uch-son-ekubi

GCD of three numbers

Easy 1000 ms 128 MB 28%
Share

Write a function Gcd(a, b, c) that returns the greatest common divisor (GCD) of the positive integers $a$, $b$ and $c$.

Example 1: Gcd(12, 18, 30) → 6

Example 2: Gcd(7, 14, 5) → 1

Write only the function body.

Three numbers go into the function Gcd, which returns their greatest common divisor

Input

One line with three positive integers $a$, $b$ and $c$ — the arguments of the function.

Output

The value returned by the function: a positive integer.

Note

$1 \le a, b, c \le 10^{15}$

Examples

Input #1
12 18 30
Output #1
6
Input #2
7 14 5
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.