#include<iostream>
using namespace std;
int main()
{
long x=0;
long y=0;
cin>>x>>y;
if(y%x==0) cout<<x+y<<endl;
else cout<<y-x<<endl;
}

#include<iostream>
using namespace std;
int main()
{
long x=0;
long y=0;
cin>>x>>y;
if(y%x==0) cout<<x+y<<endl;
else cout<<y-x<<endl;
}