a, b = [int(i) for i in input().split()]

z = 0

def gcd(x,y):
    if x<y:
        z=x
        x=y
        y=z

    while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
    return y

print(gcd(a,b)) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a, b = [int(i) for i in input().split()] a [int(i) for i in input().split()] b z = 0 z 0 def gcd(x,y):
    if x<y:
        z=x
        x=y
        y=z

    while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
    return y gcd if x<y:
        z=x
        x=y
        y=z

     x<y x y z=x z x x=y x y y=z y z while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
     x%y !=0 x%y x y 0 z=x%y z x%y x y x=y x y y=z y z gcd(x,y) gcd x y return y y x x y y print(gcd(a,b)) print gcd(a,b) gcd a b z = 0 0 z def gcd(x,y):
    if x<y:
        z=x
        x=y
        y=z

    while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
    return y def gcd(x,y):
    if x<y:
        z=x
        x=y
        y=z

    while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
    return y gcd a, b = [int(i) for i in input().split()] [int(i) for i in input().split()] a b = [int(i) for i in input().split()] [int(i) for i in input().split()] b
a, b = [int(i) for i in input().split()]

z = 0

def gcd(x,y):
    if x<y:
        z=x
        x=y
        y=z

    while x%y !=0:
        z=x%y
        x=y
        y=z
        gcd(x,y)
    return y

print(gcd(a,b))