x,y = map(int, raw_input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
print gcd(x,y) x,y = map(int, raw_input().split()) x map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split y def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y) gcd if y == 0:
        return x
    else:
        return gcd(y, x%y) y == 0 y 0 return x x return gcd(y, x%y) gcd(y, x%y) gcd y x%y x y x x y y print gcd(x,y) gcd x y x,y = map(int, raw_input().split()) map(int, raw_input().split()) x y = map(int, raw_input().split()) map(int, raw_input().split()) y def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y) def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y) gcd
x,y = map(int, raw_input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
print gcd(x,y)