let rec solve acc = function
  | 0 -> acc
  | n -> solve (abs n mod 2 :: acc) (~- (n - abs n mod 2) / 2)
let solve = solve []

let () = Scanf.scanf "%d" @@ function
  | 0 -> print_endline "0"
  | n ->
      List.iter (Printf.printf "%d") (solve n);
      print_newline ()
