# -*- coding: utf-8 -*-


def gcd(x, y):
    # GCD(Greatest Common Divisor)
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    print(x)


def to_xy(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    x, y = to_xy(input())
    gcd(x, y) def gcd(x, y):
    # GCD(Greatest Common Divisor)
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    print(x) gcd if x < y:
        x, y = y, x

     x < y x y x, y = y, x x y y x while y > 0:
        r = x % y
        x = y
        y = r

     y > 0 y 0 r = x % y r x % y x y x = y x y y = r y r print(x) print x x x y y def to_xy(v):
    return [int(c) for c in v.split()] to_xy int(c) for c in v.split() for c in v.split() c v.split() v.split v split for c in v.split() int(c) int c return [int(c) for c in v.split()] [int(c) for c in v.split()] v v if __name__ == '__main__':
    x, y = to_xy(input())
    gcd(x, y) __name__ == '__main__' __name__ '__main__' x, y = to_xy(input()) x to_xy(input()) to_xy input() input y gcd(x, y) gcd x y def to_xy(v):
    return [int(c) for c in v.split()] def to_xy(v):
    return [int(c) for c in v.split()] to_xy def gcd(x, y):
    # GCD(Greatest Common Divisor)
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    print(x) def gcd(x, y):
    # GCD(Greatest Common Divisor)
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    print(x) gcd x, y = to_xy(input()) to_xy(input()) x y = to_xy(input()) to_xy(input()) y
# -*- coding: utf-8 -*-


def gcd(x, y):
    # GCD(Greatest Common Divisor)
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    print(x)


def to_xy(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    x, y = to_xy(input())
    gcd(x, y)