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

let () = 
  List.iter (Printf.printf "%d") (Scanf.scanf "%d" solve);
  print_newline ()
