import java.util.Scanner

object Main{
  val sc = new Scanner(System.in)
  def main(args: Array[String]): Unit ={

    val a = sc.nextInt
    val b = sc.nextInt

    val res = if(b % a == 0) a + b else b - a

    println(res)

  }
}