n, m = map(int, input().split())

if m % n == 0:
    print(n + m)
else:
  print(m - n) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m if m % n == 0:
    print(n + m)
else:
  print(m - n) m % n == 0 m % n m n 0 print(n + m) print n + m n m print(m - n) print m - n m n n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())

if m % n == 0:
    print(n + m)
else:
  print(m - n)