function Main(input) {
    input = input.split(" ");
    A = Number(input[0]);
    B = Number(input[1]);
    if(B % A === 0) console.log(A+B);
    else console.log(B-A)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));