import Data.List

gcd' :: Int -> Int -> Int
gcd' x 0 = x
gcd' x y = gcd' y (x `mod` y)

main = do
  line <- getLine
  let input = reverse . sort . map (read :: String -> Int) . words $ line
  putStrLn $ show $ gcd' (input !! 0) (input !! 1)