ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b):
    return a + b if b % a == 0 else b - a

a,b = mi()
print(main(a,b)) ii = lambda:int(input()) ii lambda:int(input()) int(input()) int input() input mi = lambda:list(map(int,input().split())) mi lambda:list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ix = lambda x:list(input() for _ in range(x)) ix lambda x:list(input() for _ in range(x)) list(input() for _ in range(x)) list input() input x mix = lambda x:list(mi() for _ in range(x)) mix lambda x:list(mi() for _ in range(x)) list(mi() for _ in range(x)) list mi() mi x iix = lambda x:list(int(input()) for _ in range(x)) iix lambda x:list(int(input()) for _ in range(x)) list(int(input()) for _ in range(x)) list int(input()) int input() input x def main(a,b):
    return a + b if b % a == 0 else b - a main return a + b if b % a == 0 else b - a 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 a a b b a,b = mi() a mi() mi b print(main(a,b)) print main(a,b) main a b ii = lambda:int(input()) lambda:int(input()) ii mi = lambda:list(map(int,input().split())) lambda:list(map(int,input().split())) mi mix = lambda x:list(mi() for _ in range(x)) lambda x:list(mi() for _ in range(x)) mix ix = lambda x:list(input() for _ in range(x)) lambda x:list(input() for _ in range(x)) ix def main(a,b):
    return a + b if b % a == 0 else b - a def main(a,b):
    return a + b if b % a == 0 else b - a main iix = lambda x:list(int(input()) for _ in range(x)) lambda x:list(int(input()) for _ in range(x)) iix a,b = mi() mi() a b = mi() mi() b
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b):
    return a + b if b % a == 0 else b - a

a,b = mi()
print(main(a,b))