main = getLine >>= print . uncurry gcd . (\[a,b]->(a+b,a*b)) . map (read::String->Integer) . words