#include<bits/stdc++.h>
using namespace std;
int abslote(int n){
if (n>=0) return n;
else return -n;
}
int main(){
int a,b,sub=2,count=0;
cin>>a>>b;
if (a==0||b==0) cout<<abslote(a+b);
else {
if (a==b) cout<<abslote(a);
else{
if (abslote(a)<abslote(b)) cout<<abslote(2*a)+abslote(b);
else cout<<abslote(a)+abslote(2*b);
}
}
return 0;
}