def euclid(m,n):
    while m%n>0:
        m,n=n , m%n
    else:
        return n

x,y = map(int,raw_input().split())
if x < y:
    x,y = y,x
print euclid(x,y) def euclid(m,n):
    while m%n>0:
        m,n=n , m%n
    else:
        return n euclid while m%n>0:
        m,n=n , m%n
    else:
        return n m%n>0 m%n m n 0 m,n=n , m%n m n n m%n m n return n n m m n n x,y = map(int,raw_input().split()) x map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split y if x < y:
    x,y = y,x x < y x y x,y = y,x x y y x print euclid(x,y) euclid x y x,y = y,x y x x,y = map(int,raw_input().split()) map(int,raw_input().split()) x y = map(int,raw_input().split()) map(int,raw_input().split()) y def euclid(m,n):
    while m%n>0:
        m,n=n , m%n
    else:
        return n def euclid(m,n):
    while m%n>0:
        m,n=n , m%n
    else:
        return n euclid y = y,x x y
def euclid(m,n):
    while m%n>0:
        m,n=n , m%n
    else:
        return n

x,y = map(int,raw_input().split())
if x < y:
    x,y = y,x
print euclid(x,y)