import sys
import math
import bisect
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a, b = na()
if b % a == 0:
    print(a+b)
else:
    print(b-a) import sys sys import math math import bisect bisect stdin = sys.stdin stdin sys.stdin sys stdin mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 ns = lambda: stdin.readline().rstrip() ns lambda: stdin.readline().rstrip() stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip ni = lambda: int(ns()) ni lambda: int(ns()) int(ns()) int ns() ns na = lambda: list(map(int, stdin.readline().split())) na lambda: list(map(int, stdin.readline().split())) list(map(int, stdin.readline().split())) list map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split list(map(int, stdin.readline().split())) for i in range(h) for i in range(h) i range(h) range h for i in range(h) list(map(int, stdin.readline().split())) list map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] sa lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] [list(map(int, stdin.readline().split())) for i in range(h)] h a, b = na() a na() na 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 ni = lambda: int(ns()) lambda: int(ns()) ni stdin = sys.stdin sys.stdin stdin ns = lambda: stdin.readline().rstrip() lambda: stdin.readline().rstrip() ns na = lambda: list(map(int, stdin.readline().split())) lambda: list(map(int, stdin.readline().split())) na a, b = na() na() a b = na() na() b mod = 10**9 + 7 10**9 + 7 mod sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] lambda h: [list(map(int, stdin.readline().split())) for i in range(h)] sa
import sys
import math
import bisect
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a, b = na()
if b % a == 0:
    print(a+b)
else:
    print(b-a)