#include using namespace std; void solve(){ int a, b; cin >> a >> b; int same = 2*(min(a, b)); int diff = abs(b- a); if(same <= diff){ cout << diff << "\n"; }else{ int ans = (same - diff)%4; cout << min(4 - ans, ans) << "\n"; } } int main(){ ios::sync_with_stdio(false); cin.tie(0); // int t; // cin >> t; // while(t--){ // solve(); // } solve(); return 0; }