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

if __name__ == "__main__":
  resolve() def resolve():
  a, b = map(int, input().split())
  if b % a == 0:
    print(a+b)
  else:
    print(b-a)
  return resolve a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () 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 return if __name__ == "__main__":
  resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def resolve():
  a, b = map(int, input().split())
  if b % a == 0:
    print(a+b)
  else:
    print(b-a)
  return def resolve():
  a, b = map(int, input().split())
  if b % a == 0:
    print(a+b)
  else:
    print(b-a)
  return resolve
def resolve():
  a, b = map(int, input().split())
  if b % a == 0:
    print(a+b)
  else:
    print(b-a)
  return

if __name__ == "__main__":
  resolve()
