a, b = list(map(int, input().split()))

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

a,b=list(map(int,input().split()));print(([b+a,b-a][b%a>0]))
a, b = list(map(int, input().split()))
print(((a + b) if b % a == 0 else (b - a)))

a, b = list(map(int, input().split()))
print(([b + a, b - a][b % a > 0]))

-print(((a + b) if b % a == 0 else (b - a))) +print(([b + a, b - a][b % a > 0]))