#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define for1(i,a,b) for(ll i=(ll)a;i<=(ll)b;++i)
#define for0(i,a,b) for(ll i=(ll)a;i>=(ll)b;--i)
#define lb (ll)bool
int a, b, p;
unordered_map <unsigned ll, unordered_map <unsigned ll, int>> dp;
int main(){
ios::sync_with_stdio (0);cin.tie (0);cout.tie (0);
cin >>a >>b;
p += a<0?a:0, p += b<0?b:0;
a = abs (a), b = abs (b);
for1 (i, 1, max (a, b)){
for1 (j, 0, i){
dp[i][j] = max (dp[i-1][j]+1, dp[i][j-1]+1);
}
}
cout <<max (dp[a][b], dp[b][a])+p*2;
return 0;
}