object Main extends App {
    val ab = scala.io.StdIn.readLine().split("\\s").map(_.toInt)
    val a =  ab(0)
    val b =  ab(1)

    if (b%a == 0){
        println(a+b)
    } else {
        println(b-a)
    }
}