def gcd(x, y):
    if x < y:
        x, y = [y, x]

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

x, y = [int(n) for n in input().split()]
print(gcd(x, y))
 def gcd(x, y):
    if x < y:
        x, y = [y, x]

    while y > 0:
        r = x % y
        x = y
        y = r
    return x gcd if x < y:
        x, y = [y, x]

     x < y x y x, y = [y, x] x [y, x] y x y 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 return x x 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(gcd(x, y)) print gcd(x, y) gcd x y def gcd(x, y):
    if x < y:
        x, y = [y, x]

    while y > 0:
        r = x % y
        x = y
        y = r
    return x def gcd(x, y):
    if x < y:
        x, y = [y, x]

    while y > 0:
        r = x % y
        x = y
        y = r
    return x gcd x, y = [int(n) for n in input().split()] [int(n) for n in input().split()] x y = [int(n) for n in input().split()] [int(n) for n in input().split()] y
def gcd(x, y):
    if x < y:
        x, y = [y, x]

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

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

