input_line = input()
A,B = [int(s) for s in input_line.split(' ') if s]

def answer(A,B):
    return A+B if B % A == 0 else B-A

print(answer(A,B)) input_line = input() input_line input() input int(s) for s in input_line.split(' ') if s for s in input_line.split(' ') if s s input_line.split(' ') input_line.split input_line split ' ' s if s int(s) int s A,B = [int(s) for s in input_line.split(' ') if s] A [int(s) for s in input_line.split(' ') if s] B def answer(A,B):
    return A+B if B % A == 0 else B-A answer return A+B if B % A == 0 else B-A A+B if B % A == 0 else B-A B % A == 0 B % A B A 0 A+B A B B-A B A A A B B print(answer(A,B)) print answer(A,B) answer A B B = [int(s) for s in input_line.split(' ') if s] [int(s) for s in input_line.split(' ') if s] B input_line = input() input() input_line A,B = [int(s) for s in input_line.split(' ') if s] [int(s) for s in input_line.split(' ') if s] A def answer(A,B):
    return A+B if B % A == 0 else B-A def answer(A,B):
    return A+B if B % A == 0 else B-A answer
input_line = input()
A,B = [int(s) for s in input_line.split(' ') if s]

def answer(A,B):
    return A+B if B % A == 0 else B-A

print(answer(A,B))