def solve(a, b):
    if b % a == 0:
        return b + a
    else:
        return b - a


def main():
    a, b = map(int, input().split())

    ans = solve(a, b)
    print(ans)


main() def solve(a, b):
    if b % a == 0:
        return b + a
    else:
        return b - a solve if b % a == 0:
        return b + a
    else:
        return b - a b % a == 0 b % a b a 0 return b + a b + a b a return b - a b - a b a a a b b def main():
    a, b = map(int, input().split())

    ans = solve(a, b)
    print(ans) main a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b ans = solve(a, b) ans solve(a, b) solve a b print(ans) print ans main() main def solve(a, b):
    if b % a == 0:
        return b + a
    else:
        return b - a def solve(a, b):
    if b % a == 0:
        return b + a
    else:
        return b - a solve def main():
    a, b = map(int, input().split())

    ans = solve(a, b)
    print(ans) def main():
    a, b = map(int, input().split())

    ans = solve(a, b)
    print(ans) main
def solve(a, b):
    if b % a == 0:
        return b + a
    else:
        return b - a


def main():
    a, b = map(int, input().split())

    ans = solve(a, b)
    print(ans)


main()
