def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
a,b = iim()

if b%a == 0:
    print(a+b)
else:
    print(b-a) def ii():return int(input()) ii def iim():return map(int,input().split()) iim def iil():return list(map(int,input().split())) iil a,b = iim() a iim() iim 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 def iim():return map(int,input().split()) def iim():return map(int,input().split()) iim def iil():return list(map(int,input().split())) def iil():return list(map(int,input().split())) iil b = iim() iim() b a,b = iim() iim() a def ii():return int(input()) def ii():return int(input()) ii
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
a,b = iim()

if b%a == 0:
    print(a+b)
else:
    print(b-a)