"""
author : halo2halo
date : 15, Jan, 2020
"""

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
print(A + B if B % A == 0 else B - A) """
author : halo2halo
date : 15, Jan, 2020
""" import sys sys import numpy as np numpy 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 sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B print(A + B if B % A == 0 else B - A) print A + B if B % A == 0 else B - A B % A == 0 B % A B A 0 A + B A B B - A B A readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines A, B = map(int, readline().split()) map(int, readline().split()) A B = map(int, readline().split()) map(int, readline().split()) B read = sys.stdin.buffer.read sys.stdin.buffer.read read readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline
"""
author : halo2halo
date : 15, Jan, 2020
"""

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().split())
print(A + B if B % A == 0 else B - A)
