import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A)




if __name__ == "__main__":
    main() import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 def mi(): return map(int,input().split()) mi def ii(): return int(input()) ii def isp(): return input().split() isp def deb(text): print("-------\n{}\n-------".format(text)) deb text text INF=10**20 INF 10**20 10 20 def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A) main A,B=mi() A mi() mi B 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 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def ii(): return int(input()) def ii(): return int(input()) ii INF=10**20 10**20 INF def isp(): return input().split() def isp(): return input().split() isp def deb(text): print("-------\n{}\n-------".format(text)) def deb(text): print("-------\n{}\n-------".format(text)) deb def mi(): return map(int,input().split()) def mi(): return map(int,input().split()) mi def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A) def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A) main
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    A,B=mi()
    if B % A == 0:
        print(A+B)
    else:
        print(B-A)




if __name__ == "__main__":
    main()