# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B = lr()
bl = B % A == 0
print(A + B if bl else B - A) import sys sys sr = lambda: sys.stdin.readline().rstrip() sr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split A, B = lr() A lr() lr B bl = B % A == 0 bl B % A == 0 B % A B A 0 print(A + B if bl else B - A) print A + B if bl else B - A bl A + B A B B - A B A bl = B % A == 0 B % A == 0 bl sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr ir = lambda: int(sr()) lambda: int(sr()) ir A, B = lr() lr() A B = lr() lr() B lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B = lr()
bl = B % A == 0
print(A + B if bl else B - A)
