import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if b % a == 0:
    print(a+b)
else:
    print(b-a) import math math inputa = input().split() inputa input().split() ().split () input split a = int(inputa[0]) a int(inputa[0]) int inputa[0] inputa 0 b = int(inputa[1]) b int(inputa[1]) int inputa[1] inputa 1 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 inputa = input().split() input().split() inputa a = int(inputa[0]) int(inputa[0]) a b = int(inputa[1]) int(inputa[1]) b
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

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