def main():
    a, b = tuple(map(int,input().split()))
    print(gcd(a, b))

def gcd(x, y):    
    # x > y となるように並べ替え
    if x < y:
        (x, y) = (y, x)
    return x if y == 0 else gcd(y, x%y)

if __name__ == '__main__':
    main()
 def main():
    a, b = tuple(map(int,input().split()))
    print(gcd(a, b)) main a, b = tuple(map(int,input().split())) a tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split b print(gcd(a, b)) print gcd(a, b) gcd a b def gcd(x, y):    
    # x > y となるように並べ替え
    if x < y:
        (x, y) = (y, x)
    return x if y == 0 else gcd(y, x%y) gcd if x < y:
        (x, y) = (y, x)
     x < y x y (x, y) = (y, x) (x, y) x y (y, x) y x return x if y == 0 else gcd(y, x%y) x if y == 0 else gcd(y, x%y) y == 0 y 0 x gcd(y, x%y) gcd y x%y x y x x y y if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a, b = tuple(map(int,input().split()))
    print(gcd(a, b)) def main():
    a, b = tuple(map(int,input().split()))
    print(gcd(a, b)) main def gcd(x, y):    
    # x > y となるように並べ替え
    if x < y:
        (x, y) = (y, x)
    return x if y == 0 else gcd(y, x%y) def gcd(x, y):    
    # x > y となるように並べ替え
    if x < y:
        (x, y) = (y, x)
    return x if y == 0 else gcd(y, x%y) gcd
def main():
    a, b = tuple(map(int,input().split()))
    print(gcd(a, b))

def gcd(x, y):    
    # x > y となるように並べ替え
    if x < y:
        (x, y) = (y, x)
    return x if y == 0 else gcd(y, x%y)

if __name__ == '__main__':
    main()

