A, B = map(int, raw_input().split())

if 0 == B % A:
  print A + B
else:
  print B - A A, B = map(int, raw_input().split()) A map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split B if 0 == B % A:
  print A + B
else:
  print B - A 0 == B % A 0 B % A B A print A + B A B print B - A B A A, B = map(int, raw_input().split()) map(int, raw_input().split()) A B = map(int, raw_input().split()) map(int, raw_input().split()) B
A, B = map(int, raw_input().split())

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