nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A, B = nl()
if B % A == 0:
    print(A+B)
else:
    print(B -A) nl = lambda: list(map(int, input().split())) nl lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sl = lambda: input().split() sl lambda: input().split() input().split() ().split () input split n = lambda: int(input()) n lambda: int(input()) int(input()) int input() input s = lambda: input() s lambda: input() input() input A, B = nl() A nl() nl 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 B = nl() nl() B A, B = nl() nl() A sl = lambda: input().split() lambda: input().split() sl n = lambda: int(input()) lambda: int(input()) n s = lambda: input() lambda: input() s nl = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) nl
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

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