object Main extends App {
    var get = scala.io.StdIn.readLine()
    var set = get.split(" ")
    val a = set(0).toInt
    val b = set(1).toInt
    if (0 == a % b) {
        println(a + b)
    } else {
        println(b - a)
    }
}