def gcd(x,y):
    while y:
        x, y = y, x % y
    return x

a,b = map(int, raw_input().split())
print gcd(a, b) def gcd(x,y):
    while y:
        x, y = y, x % y
    return x gcd while y:
        x, y = y, x % y
     y x, y = y, x % y x y y x % y x y return x x x x y y a,b = map(int, raw_input().split()) a map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split b print gcd(a, b) gcd a b def gcd(x,y):
    while y:
        x, y = y, x % y
    return x def gcd(x,y):
    while y:
        x, y = y, x % y
    return x gcd a,b = map(int, raw_input().split()) map(int, raw_input().split()) a b = map(int, raw_input().split()) map(int, raw_input().split()) b
def gcd(x,y):
    while y:
        x, y = y, x % y
    return x

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