a,b = map(int,raw_input().split(' '))

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

print gcd(a,b) a,b = map(int,raw_input().split(' ')) a map(int,raw_input().split(' ')) map int raw_input().split(' ') ().split () raw_input split ' ' b def gcd(a,b):
    if a < b:
        a,b = b,a
    if a%b==0:
        return b
    else:
        return gcd(b,a%b) gcd if a < b:
        a,b = b,a
     a < b a b a,b = b,a a b b a if a%b==0:
        return b
    else:
        return gcd(b,a%b) a%b==0 a%b a b 0 return b b return gcd(b,a%b) gcd(b,a%b) gcd b a%b a b a a b b print gcd(a,b) gcd a b b = map(int,raw_input().split(' ')) map(int,raw_input().split(' ')) b a,b = map(int,raw_input().split(' ')) map(int,raw_input().split(' ')) a def gcd(a,b):
    if a < b:
        a,b = b,a
    if a%b==0:
        return b
    else:
        return gcd(b,a%b) def gcd(a,b):
    if a < b:
        a,b = b,a
    if a%b==0:
        return b
    else:
        return gcd(b,a%b) gcd
a,b = map(int,raw_input().split(' '))

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

print gcd(a,b)