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

print(gcd(*[int(i) for i in input().split()])) def gcd(x, y):
    if x % y != 0:
        return gcd(y, x % y)
    return y gcd if x % y != 0:
        return gcd(y, x % y)
     x % y != 0 x % y x y 0 return gcd(y, x % y) gcd(y, x % y) gcd y x % y x y return y y x x y y 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 print(gcd(*[int(i) for i in input().split()])) print gcd(*[int(i) for i in input().split()]) gcd *[int(i) for i in input().split()] [int(i) for i in input().split()] def gcd(x, y):
    if x % y != 0:
        return gcd(y, x % y)
    return y def gcd(x, y):
    if x % y != 0:
        return gcd(y, x % y)
    return y gcd
def gcd(x, y):
    if x % y != 0:
        return gcd(y, x % y)
    return y

print(gcd(*[int(i) for i in input().split()]))