def sort_two_nums_tuple(x,y):
    return max(x,y),min(x,y)

def calculate_gcd(x,y):
    remain = float('inf')
    while remain != 0:
        remain = x % y
        x = y
        y = remain
    return x

input_x,input_y = map(int,input().split())
x,y = sort_two_nums_tuple(input_x,input_y)
ans = calculate_gcd(x,y)
print(ans) def sort_two_nums_tuple(x,y):
    return max(x,y),min(x,y) sort_two_nums_tuple return max(x,y),min(x,y) return max(x,y),min(x,y) max(x,y) max x y min(x,y) min x y x x y y def calculate_gcd(x,y):
    remain = float('inf')
    while remain != 0:
        remain = x % y
        x = y
        y = remain
    return x calculate_gcd remain = float('inf') remain float('inf') float 'inf' while remain != 0:
        remain = x % y
        x = y
        y = remain
     remain != 0 remain 0 remain = x % y remain x % y x y x = y x y y = remain y remain return x x x x y y input_x,input_y = map(int,input().split()) input_x map(int,input().split()) map int input().split() ().split () input split input_y x,y = sort_two_nums_tuple(input_x,input_y) x sort_two_nums_tuple(input_x,input_y) sort_two_nums_tuple input_x input_y y ans = calculate_gcd(x,y) ans calculate_gcd(x,y) calculate_gcd x y print(ans) print ans y = sort_two_nums_tuple(input_x,input_y) sort_two_nums_tuple(input_x,input_y) y ans = calculate_gcd(x,y) calculate_gcd(x,y) ans input_x,input_y = map(int,input().split()) map(int,input().split()) input_x def calculate_gcd(x,y):
    remain = float('inf')
    while remain != 0:
        remain = x % y
        x = y
        y = remain
    return x def calculate_gcd(x,y):
    remain = float('inf')
    while remain != 0:
        remain = x % y
        x = y
        y = remain
    return x calculate_gcd def sort_two_nums_tuple(x,y):
    return max(x,y),min(x,y) def sort_two_nums_tuple(x,y):
    return max(x,y),min(x,y) sort_two_nums_tuple input_y = map(int,input().split()) map(int,input().split()) input_y x,y = sort_two_nums_tuple(input_x,input_y) sort_two_nums_tuple(input_x,input_y) x
def sort_two_nums_tuple(x,y):
    return max(x,y),min(x,y)

def calculate_gcd(x,y):
    remain = float('inf')
    while remain != 0:
        remain = x % y
        x = y
        y = remain
    return x

input_x,input_y = map(int,input().split())
x,y = sort_two_nums_tuple(input_x,input_y)
ans = calculate_gcd(x,y)
print(ans)
