INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a)
if __name__ == '__main__':
    do() INT = lambda: int(input()) INT lambda: int(input()) int(input()) int input() input INTM = lambda: map(int,input().split()) INTM lambda: map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split STRM = lambda: map(str,input().split()) STRM lambda: map(str,input().split()) map(str,input().split()) map str input().split() ().split () input split STR = lambda: str(input()) STR lambda: str(input()) str(input()) str input() input LIST = lambda: list(map(int,input().split())) LIST lambda: list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split LISTS = lambda: list(map(str,input().split())) LISTS lambda: list(map(str,input().split())) list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a) do a,b=INTM() a INTM() INTM 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 if __name__ == '__main__':
    do() __name__ == '__main__' __name__ '__main__' do() do LISTS = lambda: list(map(str,input().split())) lambda: list(map(str,input().split())) LISTS STRM = lambda: map(str,input().split()) lambda: map(str,input().split()) STRM INTM = lambda: map(int,input().split()) lambda: map(int,input().split()) INTM LIST = lambda: list(map(int,input().split())) lambda: list(map(int,input().split())) LIST def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a) def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a) do STR = lambda: str(input()) lambda: str(input()) STR INT = lambda: int(input()) lambda: int(input()) INT
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if b%a==0:
        print(a+b)
    else:
        print(b-a)
if __name__ == '__main__':
    do()