import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val A = Integer.parseInt(sc.next())
    val B = Integer.parseInt(sc.next())
    
    println(if (B % A == 0) A + B else B - A)
  }
}