function Main(args){
    const input=args.split(" ");
    const A=parseInt(input[0]);
    const B=parseInt(input[1]);
    const ans=B%A==0?A+B:B-A;
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));