import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

a,b = na()
if b%a == 0:
	print(a+b)
else:
	print(b-a) import sys sys stdin = sys.stdin stdin sys.stdin sys stdin ni = lambda: int(ns()) ni lambda: int(ns()) int(ns()) int ns() ns na = lambda: list(map(int, stdin.readline().split())) na lambda: list(map(int, stdin.readline().split())) list(map(int, stdin.readline().split())) list map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split ns = lambda: stdin.readline().rstrip() ns lambda: stdin.readline().rstrip() stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip a,b = na() a na() na 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 na = lambda: list(map(int, stdin.readline().split())) lambda: list(map(int, stdin.readline().split())) na a,b = na() na() a ns = lambda: stdin.readline().rstrip() lambda: stdin.readline().rstrip() ns b = na() na() b stdin = sys.stdin sys.stdin stdin ni = lambda: int(ns()) lambda: int(ns()) ni
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces

a,b = na()
if b%a == 0:
	print(a+b)
else:
	print(b-a)