import sys
A, B = map(int, sys.stdin.readline().rstrip().split())
if B % A == 0:
    print(A + B)
else:
    print(B - A) import sys sys A, B = map(int, sys.stdin.readline().rstrip().split()) A map(int, sys.stdin.readline().rstrip().split()) map int sys.stdin.readline().rstrip().split() sys.stdin.readline().rstrip().split sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip 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 A, B = map(int, sys.stdin.readline().rstrip().split()) map(int, sys.stdin.readline().rstrip().split()) A B = map(int, sys.stdin.readline().rstrip().split()) map(int, sys.stdin.readline().rstrip().split()) B
import sys
A, B = map(int, sys.stdin.readline().rstrip().split())
if B % A == 0:
    print(A + B)
else:
    print(B - A)