def gcd(a,b):
    if(b):
        return gcd(b,a%b)
    return a

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

l = raw_input().split()
if(int(l[0]) > int(l[1])):
    print gcd(int(l[0]),int(l[1]))
else:
    print gcd(int(l[1]),int(l[0]))
