# coding:utf-8
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
n = map(int, raw_input().split())
n.sort(reverse=True)
print gcd(n[0],n[1]) def gcd(a,b):
    while b:
        a, b = b, a % b
    return a gcd while b:
        a, b = b, a % b
     b a, b = b, a % b a b b a % b a b return a a a a b b n = map(int, raw_input().split()) n map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split n.sort(reverse=True) n.sort n sort reverse=True reverse True print gcd(n[0],n[1]) gcd n[0] n 0 n[1] n 1 def gcd(a,b):
    while b:
        a, b = b, a % b
    return a def gcd(a,b):
    while b:
        a, b = b, a % b
    return a gcd n = map(int, raw_input().split()) map(int, raw_input().split()) n
# coding:utf-8
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
n = map(int, raw_input().split())
n.sort(reverse=True)
print gcd(n[0],n[1])