
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def main():
    l, r = tuple(map(int, input().split(' ')))
    print(gcd(l, r))

main() def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) gcd if y == 0:
        return x
    else:
        return gcd(y, x % y) y == 0 y 0 return x x return gcd(y, x % y) gcd(y, x % y) gcd y x % y x y x x y y def main():
    l, r = tuple(map(int, input().split(' ')))
    print(gcd(l, r)) main l, r = tuple(map(int, input().split(' '))) l tuple(map(int, input().split(' '))) tuple map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' r print(gcd(l, r)) print gcd(l, r) gcd l r main() main def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) gcd def main():
    l, r = tuple(map(int, input().split(' ')))
    print(gcd(l, r)) def main():
    l, r = tuple(map(int, input().split(' ')))
    print(gcd(l, r)) main

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def main():
    l, r = tuple(map(int, input().split(' ')))
    print(gcd(l, r))

main()
