A,B=(int(x) for x in input().split())
if(B % A == 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 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 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())
if(B % A == 0):
  print(A + B)
else:
  print(B - A)