object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').map(_.toLong).toArray).head
  val A = ls(0)
  val B = ls(1)
  val ret = if(B % A == 0) A + B else B - A  
  println(ret)
}
