(* O(1) *)
let a, b = Scanf.scanf " %d %d" @@ fun a b -> a, b
let f0 x = if x mod 2 = 1 then (x + 1) / 2 mod 2 else x / 2 mod 2 lxor x
let f a b = if a = 0 then f0 b else f0 (a - 1) lxor f0 b
let _ = f a b |> Printf.printf "%d\n"