fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let a: isize = itr.next().unwrap().parse().unwrap(); let b: isize = itr.next().unwrap().parse().unwrap(); let x = std::cmp::min(a, b); let y = (a + b) / 4; let z = (a + b) / 4 + 1; let mut ans = (a + b - 4 * x).abs(); if y <= x { ans = std::cmp::min(ans, (a + b - 4 * y).abs()); } if z <= x { ans = std::cmp::min(ans, (a + b - 4 * z).abs()); } println!("{}", ans); }