import math
import collections
import sys

#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

a,b=MI()
if b%a==0:
    print(a+b)
else:
    print(b-a) import math math import collections collections import sys sys def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input def LI2(): return [int(input()) for i in range(n)] LI2 [LI()]for i in range(n) for i in range(n) i range(n) range n for i in range(n) [LI()] LI() LI def MXI(): return [[LI()]for i in range(n)] MXI a,b=MI() a MI() MI 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 MXI(): return [[LI()]for i in range(n)] def MXI(): return [[LI()]for i in range(n)] MXI a,b=MI() MI() a b=MI() MI() b def LI2(): return [int(input()) for i in range(n)] def LI2(): return [int(input()) for i in range(n)] LI2 def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def I(): return int(input()) def I(): return int(input()) I def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI
import math
import collections
import sys

#input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

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