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

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

x,y=map(int,raw_input().split())
print(gcd(x,y))