let () = Scanf.scanf "%d"
           (fun n ->
             let rec minus2ary_from_10ary quotient ans_l =
               match quotient with
               | 0 -> ans_l
               | n when n > 0 -> minus2ary_from_10ary (n / -2) (n mod -2 :: ans_l)
               | n when n mod -2 == 0 -> minus2ary_from_10ary (n / -2) (0 :: ans_l)
               | n ->  minus2ary_from_10ary (n / -2 + 1) (1 :: ans_l)  (* 結果の調整 *)
             in
             let rec make_int_from_l l ans =
               match l with
               | [] -> ans
               | x :: xs -> make_int_from_l xs (ans * 10 + x)
             in
             Printf.printf "%d" (make_int_from_l (minus2ary_from_10ary (n) []) 0))