def main():
    a, b = tuple(map(int,input().split()))
    if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
    print(gcd(a, b))

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

if __name__ == '__main__':
    main()
 def main():
    a, b = tuple(map(int,input().split()))
    if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
    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 if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
     a < b a b (a, b) = (b, a) (a, b) a b (b, a) b a print(gcd(a, b)) print gcd(a, b) gcd a b 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 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' 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():
    a, b = tuple(map(int,input().split()))
    if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
    print(gcd(a, b)) def main():
    a, b = tuple(map(int,input().split()))
    if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
    print(gcd(a, b)) main
def main():
    a, b = tuple(map(int,input().split()))
    if a < b:
        (a, b) = (b, a)
        # a > b となるように並べ替え
    print(gcd(a, b))

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

if __name__ == '__main__':
    main()

