import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

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

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

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

if __name__ == '__main__':
    main()
