#include using namespace std; using ll = long long; int main(){ ll a, b; cin >> a >> b; ll ans = 1LL<<60; for(ll i = 0;i <= min(a, b);++i){ for(ll j = 0;j <= min(a, b);++j){ if(a-i != b-j) continue; ll nat = i+j; ll unnat = (b-i) + (a-j); ans = min(ans, abs(nat - unnat)); } } cout << ans << endl; }