A, B = list(map(int, input().split()))

is_divisor = B % A == 0
answer = A + B if is_divisor else B - A

print(answer) A, B = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split B is_divisor = B % A == 0 is_divisor B % A == 0 B % A B A 0 answer = A + B if is_divisor else B - A answer A + B if is_divisor else B - A is_divisor A + B A B B - A B A print(answer) print answer A, B = list(map(int, input().split())) list(map(int, input().split())) A is_divisor = B % A == 0 B % A == 0 is_divisor answer = A + B if is_divisor else B - A A + B if is_divisor else B - A answer B = list(map(int, input().split())) list(map(int, input().split())) B
A, B = list(map(int, input().split()))

is_divisor = B % A == 0
answer = A + B if is_divisor else B - A

print(answer)