import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


a, b = LI()
if b % a == 0:
    print(a+b)
else:
    print(b-a) import sys sys def input(): return sys.stdin.readline().strip() input def I(): return int(input()) I def LI(): return list(map(int, input().split())) LI I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)] SR n n def S(): return input() S def LS(): return input().split() LS INF = float('inf') INF float('inf') float 'inf' a, b = LI() a LI() LI 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 def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def LS(): return input().split() def LS(): return input().split() LS def I(): return int(input()) def I(): return int(input()) I def IR(n): return [I() for i in range(n)] def IR(n): return [I() for i in range(n)] IR b = LI() LI() b INF = float('inf') float('inf') INF def SR(n): return [S() for i in range(n)] def SR(n): return [S() for i in range(n)] SR a, b = LI() LI() a def S(): return input() def S(): return input() S def LIR(n): return [LI() for i in range(n)] def LIR(n): return [LI() for i in range(n)] LIR
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


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