function main(input) {
    const args = input.split(' ');
    var A = parseInt(args[0], 10);
    var B = parseInt(args[1], 10);

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

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