import sys
input = sys.stdin.readline
A,B = [int(i) for i in input().split()]
if B % A == 0:
    print(A + B)
else :
    print(B-A) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A,B = [int(i) for i in input().split()] A [int(i) for i in input().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 input = sys.stdin.readline sys.stdin.readline input A,B = [int(i) for i in input().split()] [int(i) for i in input().split()] A B = [int(i) for i in input().split()] [int(i) for i in input().split()] B
import sys
input = sys.stdin.readline
A,B = [int(i) for i in input().split()]
if B % A == 0:
    print(A + B)
else :
    print(B-A)