#! python3
# greatest_common_divisor.py

def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r)

x, y = [int(n) for n in input().split(' ')]
print(greatest_common_divisor(x, y)) def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r) greatest_common_divisor r = None r None if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

     x >= y x y r = x%y r x%y x y if r == 0: return y
     r == 0 r 0 r = y%x r y%x y x if r == 0: return x

     r == 0 r 0 return greatest_common_divisor(y, r) greatest_common_divisor(y, r) greatest_common_divisor y r x x y y int(n) for n in input().split(' ') for n in input().split(' ') n input().split(' ') ().split () input split ' ' for n in input().split(' ') int(n) int n x, y = [int(n) for n in input().split(' ')] x [int(n) for n in input().split(' ')] y print(greatest_common_divisor(x, y)) print greatest_common_divisor(x, y) greatest_common_divisor x y def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r) def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r) greatest_common_divisor y = [int(n) for n in input().split(' ')] [int(n) for n in input().split(' ')] y x, y = [int(n) for n in input().split(' ')] [int(n) for n in input().split(' ')] x
#! python3
# greatest_common_divisor.py

def greatest_common_divisor(x, y):
    r = None

    if x >= y:
        r = x%y
        if r == 0: return y
    else:
        r = y%x
        if r == 0: return x

    return greatest_common_divisor(y, r)

x, y = [int(n) for n in input().split(' ')]
print(greatest_common_divisor(x, y))
