from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

A,B = inpl()
if B%A == 0:
    print(A+B)
else:
    print(B-A) from collections import defaultdict import sys,heapq,bisect,math,itertools,string,queue,datetime sys heapq bisect math itertools string queue datetime sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 INF = float('inf') INF float('inf') float 'inf' mod = 10**9+7 mod 10**9+7 10**9 10 9 7 eps = 10**-7 eps 10**-7 10 -7 def inpl(): return list(map(int, input().split())) inpl def inpl_str(): return list(input().split()) inpl_str A,B = inpl() A inpl() inpl 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 eps = 10**-7 10**-7 eps def inpl(): return list(map(int, input().split())) def inpl(): return list(map(int, input().split())) inpl A,B = inpl() inpl() A mod = 10**9+7 10**9+7 mod INF = float('inf') float('inf') INF def inpl_str(): return list(input().split()) def inpl_str(): return list(input().split()) inpl_str B = inpl() inpl() B
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

A,B = inpl()
if B%A == 0:
    print(A+B)
else:
    print(B-A)
