'use strict'

function main(input) {
  input = input.split(" ").map(v => parseInt(v, 10));
  const A = input[0];
  const B = input[1];
  if (B % A === 0)
    return A + B;
  else
    return B - A;
}

const fs = require("fs");
const msg = main(fs.readFileSync("/dev/stdin", "utf8"));
console.log(msg);
