import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    if b%a==0:
        print(a+b)
    else:
        print(b-a)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit() import sys sys from io import StringIO import unittest unittest def yn(b):
    print("Yes" if b==1 else "No")
    return yn print("Yes" if b==1 else "No") print "Yes" if b==1 else "No" b==1 b 1 "Yes" "No" return b b def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    if b%a==0:
        print(a+b)
    else:
        print(b-a)

    return resolve readline=sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline a,b=map(int, readline().rstrip().split()) a map(int, readline().rstrip().split()) map int readline().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () 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 return if 'doTest' not in globals():
    resolve()
    sys.exit() 'doTest' not in globals() 'doTest' globals() globals resolve() resolve sys.exit() sys.exit sys exit def yn(b):
    print("Yes" if b==1 else "No")
    return def yn(b):
    print("Yes" if b==1 else "No")
    return yn def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    if b%a==0:
        print(a+b)
    else:
        print(b-a)

    return def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    if b%a==0:
        print(a+b)
    else:
        print(b-a)

    return resolve
import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    if b%a==0:
        print(a+b)
    else:
        print(b-a)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()