Scanf.scanf "%d %d" (fun a b ->
    let calc k =
        let rec loop i acc =
            if i = 42 then acc else
                let l = 1 lsl i in
                let m = l + l in
                let c = k mod m in
                if c < l       then loop (i + 1) acc else
                if c mod 2 = 1 then loop (i + 1) acc
                               else loop (i + 1) (acc lor l)
        in
        let q = k mod 4 in
        let acc = if q = 1 || q = 2 then 1 else 0 in
        loop 1 acc 
    in
    Printf.printf "%d\n" @@ if a = 0 then calc b else calc b lxor calc (a - 1);
)