//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

// constant value
#define MOD 1000000007

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Computational Complexity: O(log(max(a, b))) 
template<class Integer>
inline Integer getGCD(Integer a, Integer b)
{
	if (b == 0)
	{
		return a;
	}
	return getGCD(b, a % b);
}

// Computational Complexity: O(log(max(a, b))) 
template<class Integer>
inline pair<Integer, Integer> getBezoutsIdentitySoulution(Integer a, Integer b)
{
	if (b == 0)
	{
		return { 1, 0 };
	}
	auto sol = getBezoutsIdentitySoulution(b, a % b);
	return { sol.second, sol.first - (a / b) * sol.second };
}

// Computational Complexity: O(log(max(a, n))) 
template<class Integer>
inline Integer getModInverse(Integer a, Integer n)
{
	auto sol = getBezoutsIdentitySoulution(a, n);
	if (a * sol.first + n * sol.second != 1)
	{
		return -1;
	}
	return (sol.first >= 0 ? sol.first : sol.first + n);
}

template<class Integer>
inline Integer getCeilExponent(Integer a)
{
    if (a <= 0)
    {
        return 0;
    }

    Integer index = 0;
    --a;
    for( ; a != 0; a >>= 1 )
    {
        ++index;
    }
    return index;
}

template<class Integer>
inline Integer getFloorExponent(Integer a)
{
    if (a <= 0)
    {
        return 0;
    }

    Integer index = 0;
    a >>= 1;
    for( ; a != 0; a >>= 1 )
    {
        ++index;
    }
    return index;
}

class UnionFindTree
{
private:
    const unsigned elemCount_;
    vector<unsigned> parentNodeNumbers_;
    vector<unsigned> treeDepths_;
    
	// Average Computational Complexity: O(log(elemCount_))) 
	unsigned getRootNode(unsigned x)
    {
        if (parentNodeNumbers_[x] == x)
        {
            return x;
        }
        else
        {
            return getRootNode(parentNodeNumbers_[x]);
        }
    }

public:
    UnionFindTree(unsigned elemCount) : elemCount_(elemCount), parentNodeNumbers_(elemCount), treeDepths_(elemCount, 0)
    {
        for (unsigned i = 0; i < parentNodeNumbers_.size(); ++i) 
        {
            parentNodeNumbers_[i] = i;
        }
    }

	// Average Computational Complexity: O(log(elemCount_))) 
	void uniteSet(unsigned x, unsigned y)
    {
        x = getRootNode(x);
        y = getRootNode(y);
        if ( x == y )
        {
            return;
        }
        
        if (treeDepths_[x] < treeDepths_[y])
        {
            parentNodeNumbers_[x] = y;
        }
        else
        {
            parentNodeNumbers_[y] = x;
            if (treeDepths_[x] == treeDepths_[y])
            {
                ++treeDepths_[x];
            }
        }
    }

	// Average Computational Complexity: O(log(elemCount_))) 
	bool includedInSameSet(unsigned x, unsigned y)
    {
        return getRootNode(x) == getRootNode(y);
    }
};




int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;

	cout << (b % a == 0 ? a + b: b - a);

}


Measured memory_bytes: 256