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

if ((b%a) == 0):

    print((a + b))

else:

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

if b % a == 0:

    print((a+b))

else:

    print((b-a))
a, b = list(map(int, input().split()))
if (b % a) == 0:
    print((a + b))
else:
    print((b - a))

a, b = list(map(int, input().split()))
if b % a == 0:
    print((a + b))
else:
    print((b - a))

-if (b % a) == 0: +if b % a == 0: