import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A)


if __name__ == '__main__':
    main() import sys sys INPUT = lambda: sys.stdin.readline().rstrip() INPUT lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip MAP = lambda: map(int, INPUT().split()) MAP lambda: map(int, INPUT().split()) map(int, INPUT().split()) map int INPUT().split() ().split () INPUT split sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A) main A, B = MAP() A MAP() MAP B print(A + B if B % A == 0 else B - A) print A + B if B % A == 0 else B - A B % A == 0 B % A B A 0 A + B A B B - A B A if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main INPUT = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() INPUT MAP = lambda: map(int, INPUT().split()) lambda: map(int, INPUT().split()) MAP def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A) def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A) main
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()
    print(A + B if B % A == 0 else B - A)


if __name__ == '__main__':
    main()