import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

if B % A:
    print(B-A)
else:
    print(A+B) import sys sys sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 def ii(): return int(sys.stdin.readline()) ii def mi(): return map(int, sys.stdin.readline().split()) mi def li(): return list(map(int, sys.stdin.readline().split())) li list(map(int, sys.stdin.readline().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 N N [ini]*i for _ in range(j) for _ in range(j) _ range(j) range j for _ in range(j) [ini]*i [ini] ini i def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A)) dp2 ini ini i i j j A, B = mi() A mi() mi B if B % A:
    print(B-A)
else:
    print(A+B) B % A B A print(B-A) print B-A B A print(A+B) print A+B A B def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A)) def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A)) dp2 def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 B = mi() mi() B def li(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) li def ii(): return int(sys.stdin.readline()) def ii(): return int(sys.stdin.readline()) ii A, B = mi() mi() A def mi(): return map(int, sys.stdin.readline().split()) def mi(): return map(int, sys.stdin.readline().split()) mi
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

if B % A:
    print(B-A)
else:
    print(A+B)
