import Control.Monad
import Control.Applicative
import Data.List

main :: IO ()
main = do
  [a,b] <- (map read . words) <$> getLine :: IO [Int]
  putStrLn $ case b `mod` a of
    0 -> show (a + b)
    _ -> show (b - a)