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

    return x

def main():
    x, y = (int(n) for n in input().split())
    print(gcd(x, y))

main() 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 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 return x x x x y y def main():
    x, y = (int(n) for n in input().split())
    print(gcd(x, y)) main 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 main() main 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 def main():
    x, y = (int(n) for n in input().split())
    print(gcd(x, y)) def main():
    x, y = (int(n) for n in input().split())
    print(gcd(x, y)) main
def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x = y
        y = r

    return x

def main():
    x, y = (int(n) for n in input().split())
    print(gcd(x, y))

main()
