#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main(){
/*int T,a,Ta,b,Tb,tm,ts;
char s;
cin>>T;
while(T--){
cin>>a>>Ta>>b>>Tb>>tm>>s>>ts;
}
*/
int a,b,t;
cin>>a>>b;
if(a>0) b=-b;
else b*=2;
if((b%2==0&&a*b>0)||(b%2!=0&&a*b<0)) a=-a;
cout<<a-b<<endl;
//system("pause");
return 0;
}