'use strict'

function main(input) {

    input = input.split(' ')
    const a = ~~input[0]
    const b = ~~input[1]

    let ans;
    if (b % a === 0) {
        ans = a + b
    }
    else {
        ans = b - a
    }
    console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));