def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
        
nums = input().split()
print(gcd(int(nums[0]), int(nums[1]))) def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
         gcd c = max([a, b]) c max([a, b]) max [a, b] a b d = min([a, b]) d min([a, b]) min [a, b] a b if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
         c % d == 0 c % d c d 0 return d d return gcd(d, c % d) gcd(d, c % d) gcd d c % d c d a a b b nums = input().split() nums input().split() ().split () input split print(gcd(int(nums[0]), int(nums[1]))) print gcd(int(nums[0]), int(nums[1])) gcd int(nums[0]) int nums[0] nums 0 int(nums[1]) int nums[1] nums 1 nums = input().split() input().split() nums def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
         def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
         gcd
def gcd(a, b):
    c = max([a, b])
    d = min([a, b])
    if c % d == 0:
        return d
    else:
        return gcd(d, c % d)
        
nums = input().split()
print(gcd(int(nums[0]), int(nums[1])))
