import scala.math

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  def divisors(n: Int): List[Int] =
    for (i <- (1 to n).toList if n % i == 0) yield i

  var a , b = sc.nextInt()
  println(if(divisors(b).indexOf(a) != -1) a+b else  b-a)
}
