"use strict";
    
const main = arg => {
    const A = parseInt(arg.split("\n")[0].split(" ")[0]);
    const B = parseInt(arg.split("\n")[0].split(" ")[1]);
    
    console.log(B % A === 0 ? A + B : B - A);

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