import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main() import sys sys stdin = sys.stdin stdin sys.stdin sys stdin def ns(): return stdin.readline().rstrip() ns def ni(): return int(stdin.readline().rstrip()) ni def nm(): return map(int, stdin.readline().split()) nm def nl(): return list(map(int, stdin.readline().split())) nl def main():
    a, b = nm()
    print(a + b if b % a == 0 else b - a) main a, b = nm() a nm() nm 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 def nl(): return list(map(int, stdin.readline().split())) def nl(): return list(map(int, stdin.readline().split())) nl def main():
    a, b = nm()
    print(a + b if b % a == 0 else b - a) def main():
    a, b = nm()
    print(a + b if b % a == 0 else b - a) main def ni(): return int(stdin.readline().rstrip()) def ni(): return int(stdin.readline().rstrip()) ni def nm(): return map(int, stdin.readline().split()) def nm(): return map(int, stdin.readline().split()) nm stdin = sys.stdin sys.stdin stdin def ns(): return stdin.readline().rstrip() def ns(): return stdin.readline().rstrip() ns
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main()
