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

XY=list(map(int,input().split()))
x=max(XY)
y=min(XY)

print(euclidean_alg(x,y)) def euclidean_alg(x,y):
    while y:
        x,y=y,x%y
    return x euclidean_alg 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 XY=list(map(int,input().split())) XY list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split x=max(XY) x max(XY) max XY y=min(XY) y min(XY) min XY print(euclidean_alg(x,y)) print euclidean_alg(x,y) euclidean_alg x y XY=list(map(int,input().split())) list(map(int,input().split())) XY x=max(XY) max(XY) x def euclidean_alg(x,y):
    while y:
        x,y=y,x%y
    return x def euclidean_alg(x,y):
    while y:
        x,y=y,x%y
    return x euclidean_alg y=min(XY) min(XY) y
def euclidean_alg(x,y):
    while y:
        x,y=y,x%y
    return x

XY=list(map(int,input().split()))
x=max(XY)
y=min(XY)

print(euclidean_alg(x,y))