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

a, b = map(int, input().split())
print(gcd(a, b))
 def gcd(a, b):
    return a if b == 0 else gcd(b, a % b) gcd return a if b == 0 else gcd(b, a % b) a if b == 0 else gcd(b, a % b) b == 0 b 0 a 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 print(gcd(a, b)) print gcd(a, b) gcd a b b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a def gcd(a, b):
    return a if b == 0 else gcd(b, a % b) def gcd(a, b):
    return a if b == 0 else gcd(b, a % b) gcd
def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)

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

