def gcd(x,y):
    while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp

a = list(map(int, input().split()))

if a[0]<=a[1]:
    s = gcd(a[1],a[0])
else:
    s = gcd(a[0],a[1])

print(s) def gcd(x,y):
    while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp gcd while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp 1 tmp = x%y tmp x%y x y if tmp==0:
            return y
         tmp==0 tmp 0 return y y x = y x y y = tmp y tmp x x y y a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if a[0]<=a[1]:
    s = gcd(a[1],a[0])
else:
    s = gcd(a[0],a[1]) a[0]<=a[1] a[0] a 0 a[1] a 1 s = gcd(a[1],a[0]) s gcd(a[1],a[0]) gcd a[1] a 1 a[0] a 0 s = gcd(a[0],a[1]) s gcd(a[0],a[1]) gcd a[0] a 0 a[1] a 1 print(s) print s a = list(map(int, input().split())) list(map(int, input().split())) a def gcd(x,y):
    while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp def gcd(x,y):
    while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp gcd s = gcd(a[0],a[1]) gcd(a[0],a[1]) s s = gcd(a[1],a[0]) gcd(a[1],a[0]) s
def gcd(x,y):
    while 1:
        tmp = x%y
        if tmp==0:
            return y
        x = y
        y = tmp

a = list(map(int, input().split()))

if a[0]<=a[1]:
    s = gcd(a[1],a[0])
else:
    s = gcd(a[0],a[1])

print(s)
