function Main(input){
var A = input.split(" ")[0];
A = parseInt(A,10);
var B = input.split(" ")[1];
B = parseInt(B,10);

var ab = B % A
if(ab === 0){
    console.log(A + B);
}else{
    console.log(B - A);
}





    
}





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