function Main(input) {
    var input_arr = input.split("\n");
    var input_arr_line0 = input_arr[0].split(" ");
    var a = parseInt(input_arr_line0[0]);
    var b = parseInt(input_arr_line0[1]);
    if (b % a === 0) {
        console.log(a + b);
    } else {
        console.log(b - a)
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));