"use strict"
const main = (input) => {
  input.split(" ").map(i => parseInt(i))
  const a = input[0]
  const b = input[1]
  if(b%a === 0 & b != 0){
    console.log(a+b)
  }else{
  	console.log(b-a)
  }
}

main(require("fs").readFileSync("/dev/stdin","utf-8"))
