#!/usr/bin/env python3
import sys

def solve(A: int, B: int):
    if B % A == 0:
        return A + B
    return B - A

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main() import sys sys def solve(A: int, B: int):
    if B % A == 0:
        return A + B
    return B - A

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools solve if B % A == 0:
        return A + B
     B % A == 0 B % A B A 0 return A + B A + B A B return B - A B - A B A A: int A B: int B def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens A = int(next(tokens)) A int(next(tokens)) int next(tokens) next tokens B = int(next(tokens)) B int(next(tokens)) int next(tokens) next tokens print(solve(A, B)) print solve(A, B) solve A B def test():
    import doctest
    doctest.testmod() test import doctest doctest doctest.testmod() doctest.testmod doctest testmod if __name__ == '__main__':
    #test()
    main() __name__ == '__main__' __name__ '__main__' main() main def test():
    import doctest
    doctest.testmod() def test():
    import doctest
    doctest.testmod() test def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B)) main def solve(A: int, B: int):
    if B % A == 0:
        return A + B
    return B - A

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools def solve(A: int, B: int):
    if B % A == 0:
        return A + B
    return B - A

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools solve
#!/usr/bin/env python3
import sys

def solve(A: int, B: int):
    if B % A == 0:
        return A + B
    return B - A

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    print(solve(A, B))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
