l=[int(x) for x in raw_input().split(" ")]

def gcd(a,b):
    if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod)

print gcd(l[0], l[1]) int(x) for x in raw_input().split(" ") for x in raw_input().split(" ") x raw_input().split(" ") ().split () raw_input split " " for x in raw_input().split(" ") int(x) int x l=[int(x) for x in raw_input().split(" ")] l [int(x) for x in raw_input().split(" ")] def gcd(a,b):
    if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod) gcd if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod) a > b a b mod = a % b mod a % b a b if mod==0: return b
         mod==0 mod 0 return gcd(b, mod) gcd(b, mod) gcd b mod mod = b % a mod b % a b a if mod==0: return a
         mod==0 mod 0 return gcd(a, mod) gcd(a, mod) gcd a mod a a b b print gcd(l[0], l[1]) gcd l[0] l 0 l[1] l 1 def gcd(a,b):
    if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod) def gcd(a,b):
    if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod) gcd l=[int(x) for x in raw_input().split(" ")] [int(x) for x in raw_input().split(" ")] l
l=[int(x) for x in raw_input().split(" ")]

def gcd(a,b):
    if a > b:
        mod = a % b
        if mod==0: return b
        return gcd(b, mod)
    else:
        mod = b % a
        if mod==0: return a
        return gcd(a, mod)

print gcd(l[0], l[1])