def gcd(x, y) #x >= y
  mod = x % y
  if mod == 0
    return y
  else
    x = y
    y = mod
    gcd(x, y)
  end
end

def getStrToInt()
  return gets.split(" ").map(&:to_i)
end

array = getStrToInt
x = array.max
y = array.min
puts gcd(x, y)