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

a,b = map(int, input().split())
print(gcm(a,b)) def gcm(x,y):
    while y:
        x, y = y, x % y
    return x gcm 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, input().split()) a map(int, input().split()) map int input().split() ().split () input split b print(gcm(a,b)) print gcm(a,b) gcm a b b = map(int, input().split()) map(int, input().split()) b def gcm(x,y):
    while y:
        x, y = y, x % y
    return x def gcm(x,y):
    while y:
        x, y = y, x % y
    return x gcm a,b = map(int, input().split()) map(int, input().split()) a
def gcm(x,y):
    while y:
        x, y = y, x % y
    return x

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