def gcd(a,b):
    if b==0:
        return a
    c=a%b
    return gcd(b,c)
x,y=map(int,input().split())
if x<y:
    x,y=y,x
m=gcd(x,y)
print(m) def gcd(a,b):
    if b==0:
        return a
    c=a%b
    return gcd(b,c) gcd if b==0:
        return a
     b==0 b 0 return a a c=a%b c a%b a b return gcd(b,c) gcd(b,c) gcd b c a a b b x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y if x<y:
    x,y=y,x x<y x y x,y=y,x x y y x m=gcd(x,y) m gcd(x,y) gcd x y print(m) print m def gcd(a,b):
    if b==0:
        return a
    c=a%b
    return gcd(b,c) def gcd(a,b):
    if b==0:
        return a
    c=a%b
    return gcd(b,c) gcd m=gcd(x,y) gcd(x,y) m x,y=map(int,input().split()) map(int,input().split()) x y=y,x x y x,y=y,x y x y=map(int,input().split()) map(int,input().split()) y
def gcd(a,b):
    if b==0:
        return a
    c=a%b
    return gcd(b,c)
x,y=map(int,input().split())
if x<y:
    x,y=y,x
m=gcd(x,y)
print(m)
