A,B=[int(x) for x in input().split()]

m=B%A

if m == 0:
  print(A+B)
else:
  print(B-A) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A,B=[int(x) for x in input().split()] A [int(x) for x in input().split()] B m=B%A m B%A B A if m == 0:
  print(A+B)
else:
  print(B-A) m == 0 m 0 print(A+B) print A+B A B print(B-A) print B-A B A m=B%A B%A m A,B=[int(x) for x in input().split()] [int(x) for x in input().split()] A B=[int(x) for x in input().split()] [int(x) for x in input().split()] B
A,B=[int(x) for x in input().split()]

m=B%A

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