
object Main extends App {
  val AB = io.StdIn.readLine.split(' ')
  val A = AB.head.toInt
  val B = AB.last.toInt

  val out = B % A match {
    case 0 => B + A
    case _ => B - A
  }

  println(out)
}
