a, b = map(int, input().split())
large = max(a, b)
small = min(a, b)
if (large % small) == 0:
  print(a + b)
else:
  print(b - a) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b large = max(a, b) large max(a, b) max a b small = min(a, b) small min(a, b) min a b if (large % small) == 0:
  print(a + b)
else:
  print(b - a) (large % small) == 0 large % small large small 0 print(a + b) print a + b a b print(b - a) print b - a b a b = map(int, input().split()) map(int, input().split()) b small = min(a, b) min(a, b) small large = max(a, b) max(a, b) large a, b = map(int, input().split()) map(int, input().split()) a
a, b = map(int, input().split())
large = max(a, b)
small = min(a, b)
if (large % small) == 0:
  print(a + b)
else:
  print(b - a)