#include<algorithm>
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main ()
{
int x,y;
cin>>x>>y;
if(x>0)
{
y=-y;
}
else
{
y*=2;
}
if(abs(y)%2==1)
{
if(x*y<0)
{
x=-x;
}
}
else if(abs(y)%2==0)
{
if(x*y>0)
{
x=-x;
}
}
cout<<x-y;
}