import Control.Monad import Control.Applicative main :: IO () main = do [a,b] <- map read . words <$> getLine print $ gcd' (a+b) (a*b) gcd' :: Integer -> Integer -> Integer gcd' 0 x = x gcd' x y = gcd (y `mod` x) x