a , b = map(int, input().split())
yakusuu_list = []
for i in range(1,b+1):
    if b % i == 0:
        yakusuu_list.append(i)
if a in yakusuu_list:
    print(a + b)
else:
    print(b - a) a , b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b yakusuu_list = [] yakusuu_list [] for i in range(1,b+1):
    if b % i == 0:
        yakusuu_list.append(i) i range(1,b+1) range 1 b+1 b 1 if b % i == 0:
        yakusuu_list.append(i) b % i == 0 b % i b i 0 yakusuu_list.append(i) yakusuu_list.append yakusuu_list append i if a in yakusuu_list:
    print(a + b)
else:
    print(b - a) a in yakusuu_list a yakusuu_list print(a + b) print a + b a b print(b - a) print b - a b a yakusuu_list = [] [] yakusuu_list a , b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b
a , b = map(int, input().split())
yakusuu_list = []
for i in range(1,b+1):
    if b % i == 0:
        yakusuu_list.append(i)
if a in yakusuu_list:
    print(a + b)
else:
    print(b - a)
