x,y = map(int,input().split(" "))

def gdp(x,y):
    if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
    if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small)

gdp(x,y)
 x,y = map(int,input().split(" ")) x map(int,input().split(" ")) map int input().split(" ") ().split () input split " " y def gdp(x,y):
    if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
    if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small) gdp if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
     x > y x y big = x big x small = y small y big = y big y small = x small x if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small) big%small == 0 big%small big small 0 print(small) print small return gdp(small,big%small) gdp small big%small big small x x y y gdp(x,y) gdp x y x,y = map(int,input().split(" ")) map(int,input().split(" ")) x def gdp(x,y):
    if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
    if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small) def gdp(x,y):
    if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
    if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small) gdp y = map(int,input().split(" ")) map(int,input().split(" ")) y
x,y = map(int,input().split(" "))

def gdp(x,y):
    if x > y:
        big = x
        small = y
    else:
        big = y
        small = x
    if big%small == 0:
        print(small)
        return
    else:
        gdp(small,big%small)

gdp(x,y)

