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

if B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(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 B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(B-A) B%A == 0 B%A B A 0 print '{}'.format(A+B) '{}'.format '{}' format A+B A B print '{}'.format(B-A) '{}'.format '{}' format B-A B A B = map(int, raw_input().split()) map(int, raw_input().split()) B A, B = map(int, raw_input().split()) map(int, raw_input().split()) A
A, B = map(int, raw_input().split())

if B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(B-A)
