z = input().split()
x = int(z[0])
y = int(z[1])

def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
print(gcd(x,y)) z = input().split() z input().split() ().split () input split x = int(z[0]) x int(z[0]) int z[0] z 0 y = int(z[1]) y int(z[1]) int z[1] z 1 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 print(gcd(x,y)) print gcd(x,y) gcd x y z = input().split() input().split() z y = int(z[1]) int(z[1]) y 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 x = int(z[0]) int(z[0]) x
z = input().split()
x = int(z[0])
y = int(z[1])

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