import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

A, B = [int(x) for x in readline().rstrip().split()]
if B % A == 0:
    print(A + B)
else:
    print(B - A) import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines import numpy as np numpy int(x) for x in readline().rstrip().split() for x in readline().rstrip().split() x readline().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () readline rstrip split for x in readline().rstrip().split() int(x) int x A, B = [int(x) for x in readline().rstrip().split()] A [int(x) for x in 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 readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines B = [int(x) for x in readline().rstrip().split()] [int(x) for x in readline().rstrip().split()] B read = sys.stdin.buffer.read sys.stdin.buffer.read read A, B = [int(x) for x in readline().rstrip().split()] [int(x) for x in readline().rstrip().split()] A readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

A, B = [int(x) for x in readline().rstrip().split()]
if B % A == 0:
    print(A + B)
else:
    print(B - A)
