def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

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

a, b = map(int, input().split())
if a < b:
    a, b = b, a
print(gcd(a, b))