
str_line = input().split(" ")
num_1 = int(str_line[0])
num_2 = int(str_line[1])

if num_2%num_1 == 0:
    ans = num_1 + num_2
else:
    ans = num_2 - num_1

print(ans) str_line = input().split(" ") str_line input().split(" ") ().split () input split " " num_1 = int(str_line[0]) num_1 int(str_line[0]) int str_line[0] str_line 0 num_2 = int(str_line[1]) num_2 int(str_line[1]) int str_line[1] str_line 1 if num_2%num_1 == 0:
    ans = num_1 + num_2
else:
    ans = num_2 - num_1 num_2%num_1 == 0 num_2%num_1 num_2 num_1 0 ans = num_1 + num_2 ans num_1 + num_2 num_1 num_2 ans = num_2 - num_1 ans num_2 - num_1 num_2 num_1 print(ans) print ans ans = num_1 + num_2 num_1 + num_2 ans num_1 = int(str_line[0]) int(str_line[0]) num_1 ans = num_2 - num_1 num_2 - num_1 ans num_2 = int(str_line[1]) int(str_line[1]) num_2 str_line = input().split(" ") input().split(" ") str_line

str_line = input().split(" ")
num_1 = int(str_line[0])
num_2 = int(str_line[1])

if num_2%num_1 == 0:
    ans = num_1 + num_2
else:
    ans = num_2 - num_1

print(ans)