a,b = input().split()

A = int(a)
B = int(b)

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

A = int(a)
B = int(b)

if B % A == 0:
    print(A + B)
else:
    print(B-A)