'''A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

>>> main(4, 12)
16
>>> main(8, 20)
12
>>> main(1, 1)
2
'''


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


if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    main(a, b) '''A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

>>> main(4, 12)
16
>>> main(8, 20)
12
>>> main(1, 1)
2
''' def main(a: int, b: int):
    if (b % a) == 0:
        print(a+b)
    else:
        print(b-a) main if (b % a) == 0:
        print(a+b)
    else:
        print(b-a) (b % a) == 0 b % a b a 0 print(a+b) print a+b a b print(b-a) print b-a b a a: int a b: int b if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    main(a, b) __name__ == "__main__" __name__ "__main__" a, b = map(int, input().split(' ')) a map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' b main(a, b) main a b def main(a: int, b: int):
    if (b % a) == 0:
        print(a+b)
    else:
        print(b-a) def main(a: int, b: int):
    if (b % a) == 0:
        print(a+b)
    else:
        print(b-a) main b = map(int, input().split(' ')) map(int, input().split(' ')) b a, b = map(int, input().split(' ')) map(int, input().split(' ')) a
'''A - B +/- A
https://atcoder.jp/contests/abc118/tasks/abc118_a

>>> main(4, 12)
16
>>> main(8, 20)
12
>>> main(1, 1)
2
'''


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


if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    main(a, b)
