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

A = list(map(int,input().split()))
print(gcd(A[0], A[1])) def gcd(x, y):
    while y != 0:
        x,y = y, x % y
    return x gcd while y != 0:
        x,y = y, x % y
     y != 0 y 0 x,y = y, x % y x y y x % y x y return x x x x y y A = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split print(gcd(A[0], A[1])) print gcd(A[0], A[1]) gcd A[0] A 0 A[1] A 1 def gcd(x, y):
    while y != 0:
        x,y = y, x % y
    return x def gcd(x, y):
    while y != 0:
        x,y = y, x % y
    return x gcd A = list(map(int,input().split())) list(map(int,input().split())) A
def gcd(x, y):
    while y != 0:
        x,y = y, x % y
    return x

A = list(map(int,input().split()))
print(gcd(A[0], A[1]))