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

def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
    
if(x>=y):
    print(gcd(x,y))
else:
    print(gcd(y,x)) x, y = map(int, input().split(' ')) x map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' y def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
     gcd if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
     x2 == 0 x2 0 return x1 x1 return gcd(x2, x1 % x2) gcd(x2, x1 % x2) gcd x2 x1 % x2 x1 x2 x1 x1 x2 x2 if(x>=y):
    print(gcd(x,y))
else:
    print(gcd(y,x)) x>=y x y print(gcd(x,y)) print gcd(x,y) gcd x y print(gcd(y,x)) print gcd(y,x) gcd y x def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
     def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
     gcd x, y = map(int, input().split(' ')) map(int, input().split(' ')) x y = map(int, input().split(' ')) map(int, input().split(' ')) y
x, y = map(int, input().split(' '))

def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
    
if(x>=y):
    print(gcd(x,y))
else:
    print(gcd(y,x))
